3.5.10 RAISE_APPLICATION_ERROR

Table of Contents Previous Next


3 Stored Procedure Language : 3.5 Control Structures : 3.5.10 RAISE_APPLICATION_ERROR

The procedure, RAISE_APPLICATION_ERROR, allows a developer to intentionally abort processing within an SPL program from which it is called by causing an exception. The exception is handled in the same manner as described in Section 3.5.7. In addition, the RAISE_APPLICATION_ERROR procedure makes a user-defined code and error message available to the program which can then be used to identify the exception.
RAISE_APPLICATION_ERROR(error_number, message);
error_number is an integer value or expression that is returned in a variable named SQLCODE when the procedure is executed. error_number must be a value between ‑20000 and -20999.
message is a string literal or expression that is returned in a variable named SQLERRM.
For additional information on the SQLCODE and SQLERRM variables, see Section 3.13, Errors and Messages.
The following example uses the RAISE_APPLICATION_ERROR procedure to display a different code and message depending upon the information missing from an employee.

3 Stored Procedure Language : 3.5 Control Structures : 3.5.10 RAISE_APPLICATION_ERROR

Table of Contents Previous Next