You use the RUN STORED-PROC statement with the send-sql-statement option and pass the PL/SQL statements as a parameter. The syntax of the statement must be valid PL/SQL syntax. The following example shows how the code presented passes a SELECT statement as a parameter.
Passing a SELECT statement as a parameter
DEFINE VARIABLE iHandle AS INTEGER NO-UNDO.
RUN STORED-PROC send-sql-statement iHandle = PROC-HANDLE NO-ERROR
("select cust_num,name like ‘A_'").
FOR EACH proc-text-buffer WHERE PROC-HANDLE = iHandle:
DISPLAY proc-text-buffer.
END.
CLOSE STORED-PROC send-sql-statement WHERE PROC-HANDLE = iHandle.
This example returns the name of all customers whose name begins with A. You must read the results into a buffer as you would with a stored procedure called by an ABL procedure. You can read the results into the proc-text-buffer as defined in the example above. Alternatively, you can define your own buffer from within your data source that can accept other data type as well as the CHARACTER data type.