Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
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.
The following example shows how ABL code runs the stored procedure pcust. It uses the PROC-STATUS function and the CLOSE STORED-PROC statement to retrieve the return code and assign the value to the variable stat. The meaning of this return code is defined by the underlying data source.

Return status example

/* Return status */

DEFINE VARIABLE handle1 AS INTEGER NO-UNDO.
DEFINE VARIABLE stat    AS INTEGER NO-UNDO.

RUN STORED-PROCEDURE pcust handle1 = PROC-HANDLE (20, output 0, output 0).
CLOSE STORED-PROC pcust stat = PROC-STATUS WHERE PROC-HANDLE = handle1.
IF stat = 0 THEN
  DISPLAY "procedure succeeded".