Skip Headers
Oracle® Database PL/SQL User's Guide and Reference
10g Release 2 (10.2)

Part Number B14261-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

EXCEPTION_INIT Pragma

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".

Syntax

exception_init pragma ::=

Description of exception_init_pragma.gif follows
Description of the illustration exception_init_pragma.gif

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.

PRAGMA

Signifies that the statement is a compiler directive.

Usage Notes

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.

Examples

For examples, see the following:


Example 10-4, "Using PRAGMA EXCEPTION_INIT"
Example 11-9, "Bulk Operation That Continues Despite Exceptions"

Related Topics


"AUTONOMOUS_TRANSACTION Pragma"
"Exception Definition"
"SQLCODE Function"