Progress
DataServer
for ORACLE Guide
Returning Errors
There are two types of errors that stored procedures can encounter. The first type of error can be trapped by the stored procedure. The stored procedure can call raise_application_exception with a value ranging from -20000 to -20999 and continue processing. The DataServer checks whether an error is the result of raise_application_error. If this is the case, the DataServer stores the value, which you can retrieve with the PROC-STATUS function when you close the stored procedure. The Progress application continues to execute. The same behavior occurs when you send an SQL statement that causes a trigger to fire that results in a raise_application_error.
The second type of error is caught by the RUN STORED-PROC statement itself and the procedure stops. This error might be due to a PL/SQL compilation error or another error that is not handled.
The RUN STORED-PROC statement supports the NO-ERROR option. The following example shows how to trap errors within a procedure:
The PROC-STATUS clause of the CLOSE STORED-PROCEDURE statement allows the DataServer to retrieve the text of an error message that was passed to raise_application_error. Use the ERROR-STATUS:GET-MESSAGE handle to retrieve the message as in the following example:
In this example, the PROC-STATUS clause is necessary to enable the ERROR-STATUS:GET-MESSAGE handle to retrieve the text of the error message.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |