Try OpenEdge Now
skip to main content
DataServer for Oracle
RDBMS Stored Procedure Details : Interfacing with RDBMS stored procedures : Retrieving return codes
 

Retrieving return codes

You can create a stored procedure that provides return code information. For example, it might indicate whether the stored procedure was successful or whether it encountered an error condition.
This example shows how ABL code runs the stored procedure pcust. It uses the PROC-STATUS function and the CLOSE STORED-PROC to retrieve the return code and assign the value to the variable stat.

ABL code running the stored procedure pcust

/* Return status */
DEFINE VARIABLE iStat AS INTEGER NO-UNDO.
RUN STORED-PROC pcust
  (PARAM num = ?, OUTPUT PARAM orders = 0, OUTPUT PARAM states = 0).
CLOSE STORED-PROC pcust iStat = PROC-STATUS.
IF iStat = 0 THEN
  DISPLAY pcust.orders pcust.states.
ELSE
  DISPLAY iStat.
The Oracle return codes have a range of values between -20000 and -20999. These values are user defined and you can test for them with the PROC-STATUS function.