13.25 EXCEPTION_INIT Pragma

The EXCEPTION_INIT pragma associates a user-defined exception name with an error code.

The EXCEPTION_INIT pragma can appear only in the same declarative part as its associated exception, anywhere after the exception declaration.

Topics

Syntax

Semantics

exception_init_pragma

exception

Name of a previously declared user-defined exception.

error_code

Error code to be associated with exception. error_code can be either 100 (the numeric code for "no data found" that "SQLCODE Function" returns) or any negative integer greater than -10000000 except -1403 (another numeric code for "no data found").

Note:

NO_DATA_FOUND is a predefined exception.

If two EXCEPTION_INIT pragmas assign different error codes to the same user-defined exception, then the later pragma overrides the earlier pragma.

Examples

  • Example 11-5, "Naming Internally Defined Exception"

  • Example 11-13, "Raising User-Defined Exception with RAISE_APPLICATION_ERROR"

  • Example 12-13, "Handling FORALL Exceptions After FORALL Statement Completes"