Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
RDBMS Stored Procedure Details : Run Stored-Procedure details : Run Stored-Proc statement execution using the send-sql-statement option : With the Load-Result-Into option
 
With the Load-Result-Into option
The following example shows how to use the send-sql-statement 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 with the LOAD-RESULT-INTO option

DEFINE VARIABLE res    AS INTEGER NO-UNDO.
DEFINE VARIABLE tthndl AS HANDLE  NO-UNDO.

CREATE TEMP-TABLE tthndl.

RUN STORED-PROCEDURE send-sql-statement LOAD-RESULT-INTO tthndl
  res = PROC-STATUS ("SELECT * FROM customer").
IF res THEN
  DISPLAY "succeeded".

DISPLAY stat.
Also note that the PROC-STATUS phrase does not need an associated PROC-HANDLE phrase to close the associated procedure 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 because of the implicit procedure close.