The following example shows how to use the send-sql-statement option with the LOAD-RESULT-INTO option. It also shows that the PROC-STATUS phrase must be defined as part of the RUN STORED-PROC statement because of the implicit CLOSE STORED-PROC that is associated with the LOAD-RESULT-INTO phrase.
Using the send-sql-statement option with LOAD-RESULT-INTO option
DEFINE VARIABLE ttHandle AS HANDLE NO-UNDO.
DEFINE TEMP-TABLE tt1
FIELD f1 AS INTEGER
FIELD f2 AS CHARACTER.
ttHandle = TEMP-TABLE tt1:HANDLE.
RUN STORED-PROC send-sql-statement LOAD-RESULT-INTO ttHandle
("select cust_num, name like ‘A_'").
In the previous example, also note that the PROC-STATUS phrase does not need a PROC-HANDLE phrase because it is retrieved using the RUN STORED-PROC statement; although the PROC-HANDLE is typically used after the execution of the RUN STORED-PROC statement, it is not needed in this context.