Oracle® Database PL/SQL User's Guide and Reference 10g Release 2 (10.2) Part Number B14261-01 |
|
|
PDF · Mobi · ePub |
The pragma EXCEPTION_INIT
associates an exception name with an Oracle error number. You can intercept any ORA- error and write a specific handler for it instead of using the OTHERS
handler. For more information, see "Associating a PL/SQL Exception with a Number: Pragma EXCEPTION_INIT".
exception_init pragma ::=
Keyword and Parameter Description
error_number
Any valid Oracle error number. These are the same error numbers (always negative) returned by the function SQLCODE
.
exception_name
A user-defined exception declared within the current scope.
Signifies that the statement is a compiler directive.
You can use EXCEPTION_INIT
in the declarative part of any PL/SQL block, subprogram, or package. The pragma must appear in the same declarative part as its associated exception, somewhere after the exception declaration.
Be sure to assign only one exception name to an error number.
For examples, see the following: