## Example of "stored procedure" array processing.
## 
## Sample program to "batch" 5 storted procedure calls into one.


    PACKAGE GL AS
      function  stk_on_hand    (prod   IN varchar2, whse IN varchar2)
                                returns number;
      procedure stk_on_hand_X5 (i_cnt IN number,
                                prod1 IN varchar2, whse1 IN varchar2,
                                prod2 IN varchar2, whse2 IN varchar2,
                                prod3 IN varchar2, whse3 IN varchar2,
                                prod4 IN varchar2, whse4 IN varchar2,
                                prod5 IN varchar2, whse5 IN varchar2,
                                soh1 OUT number,   soh2 OUT number,
                                soh3 OUT number,   soh4 OUT number,
                                soh5 OUT number);
    End;

    PACKAGE BODY GL IS
      FUNCTION  stk_on_hand    (prod   IN varchar2, whse IN varchar2)
                                returns number AS
      BEGIN
        ....
        ....
      END;

      PROCEDURE stk_on_hand_X5 (i_cnt IN number,
                                prod1 IN varchar2, whse1 IN varchar2,
                                prod2 IN varchar2, whse2 IN varchar2,
                                prod3 IN varchar2, whse3 IN varchar2,
                                prod4 IN varchar2, whse4 IN varchar2,
                                prod5 IN varchar2, whse5 IN varchar2,
                                soh1 OUT number,   soh2 OUT number,
                                soh3 OUT number,   soh4 OUT number,
                                soh5 OUT number ) AS
      BEGIN
        if i_cnt >= 1 then
           soh1 := stk_on_hand (prod1, whse1);
           if i_cnt >= 2 then
              soh2 := stk_on_hand (prod2, whse2);
              if i_cnt >= 3 then
                 soh3 := stk_on_hand (prod3, whse3);
                 if i_cnt >= 4 then
                    soh4 := stk_on_hand (prod4, whse4);
                    if i_cnt = 5 then
                       soh5 := stk_on_hand (prod5, whse5);
                    end if;
                 end if;
              end if;
           end if;
        end if;
      END;


    Pro*C Program
    ....
    EXEC SQL BEGIN DECLARE SECTION;
       interger i;
       varchar  prod1[12];
       varchar  whse1[5];
       double   soh1;
       ....
       varchar  prod5[12];
       varchar  whse5[5];
       double   soh5;
    EXEC SQL END DECLARE SECTION;
    ....
    ....
    for (i = 0; i <= 5; i++)
    { 
      EXEC SQL EXECUTE
         begin
           Stk_On_Hand_X5 (:i, :prod1, :whse1,
                               ....
                               :prod5, :whse5);
         end;
      END-EXEC
    ....
    ....
