DEFINE VARIABLE hTables AS HANDLE EXTENT 2 NO-UNDO.
DEFINE TEMP-TABLE ttcust FIELD cust-num AS INTEGER FIELD NAME AS CHARACTER. DEFINE TEMP-TABLE ttord FIELD ord-num AS INTEGER FIELD ord-date AS DATE. hTables[1] = TEMP-TABLE ttcust:HANDLE. hTables[2] = TEMP-TABLE ttord:HANDLE. RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO hTables NO-ERROR ("Select cust_num, name from customer; Select order_num, order_date from order_; Select * from order_line")./*Loading three result-sets in two temp-tables raises an error*/ IF ERROR-STATUS:ERROR THEN MESSAGE ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX. ELSE DO: MESSAGE "SQL call was successful." VIEW-AS ALERT-BOX. FOR EACH ttcust: DISP ttcust.cust-num ttcust.name. END. FOR EACH ttord: DISP ttord.ord-num ttord.ord-date. END. /* CLOSE STORED-PROC not required w/LOAD-RESULT-INTO */ END. |