Technique to use proc-text-buffer

Returning database results into the proc-text-buffer and converting the results to the INTEGER data type

This example illustrates returning database results into the proc-text-buffer and converting the results to the INTEGER data type.

DEFINE VARIABLE iHandle AS INTEGER NO-UNDO.
DEFINE VARIABLE iMax    AS INTEGER NO-UNDO.

RUN STORED-PROC send-sql-statement iHandle = PROC-HANDLE
  ("SELECT max (custnum) FROM customer").
FOR EACH proc-text-buffer:
  		iMax = INTEGER(SUBSTRING(proc-text, 1, 3)).
  		 DISPLAY iMax.
END.
CLOSE STORED-PROC send-sql-statement WHERE PROC-HANDLE = iHandle.

The DataServer passes the PL/SQL statement directly to the Oracle data source. The ABL compiler does not process it, so errors occur only at run time and not when you compile a procedure.