| Oracle® Database PL/SQL Language Reference 11g Release 2 (11.2) Part Number E17126-03 |
|
|
View PDF |
An exception handler processes a raised exception. Exception handlers appear in the exception-handling parts of anonymous blocks, subprograms, triggers, and packages.
Topics:
Syntax

See "statement ::=".
Semantics
exception_name
The name of either a predefined exception (see Table 11-3) or a user-defined exception (see "Exception Name Declaration").
If PL/SQL raises a specified exception, then the associated statements run.
OTHERS
Specifies all exceptions not explicitly specified in the exception-handling part of the block. If PL/SQL raises such an exception, then the associated statement runs.
In the exception-handling part of a block, the WHEN OTHERS exception handler is optional. It can appear only once, as the last exception handler in the exception-handling part of the block.
Examples
Example 11-3, "Single Exception Handler for Multiple Exceptions"
Example 11-4, "Locator Variables for Statements That Use Same Exception Handler"
Example 11-6, "Anonymous Block with Exception Handler for ZERO_DIVIDE"
Example 11-9, "Declaring, Raising, and Handling a User-Defined Exception"
Example 11-13, "Exception That Propagates Beyond Scope is Handled"
Example 11-24, "Exception Handler Runs and Execution Continues"
Related Topics
In this chapter:
In other chapters: