Exception Declaration

An exception declaration declares a user-defined exception.

Unlike a predefined exception, a user-defined exception must be raised explicitly with either a RAISE statement or the procedure DBMS_STANDARD.RAISE_APPLICATION_ERROR. The latter lets you associate an error message with the user-defined exception.

Syntax

exception_declaration ::=

exception_declaration
Description of the illustration exception_declaration.gif

Keyword and Parameter Descriptions

exception_name

The name you give to the user-defined exception.

Caution:

Using the name of a predefined exception for exception_name is not recommended. For details, see Redeclaring Predefined Exceptions.

Example


Example 1-12, "Using WHILE-LOOP for Control"
Example 1-16, "Creating a Standalone PL/SQL Procedure"
Example 2-28, "Block with Multiple and Duplicate Labels"
Example 5-35, "Using TRIM to Decrease the Size of a Collection"
Example 5-38, "Collection Exceptions"
Example 6-37, "Using ROLLBACK"
Example 7-13, "Using Validation Checks to Guard Against SQL Injection"
Example 8-1, "Declaring, Defining, and Invoking a Simple PL/SQL Procedure"
Example 10-3, "Creating the emp_admin Package"
Example 11-1, "Run-Time Error Handling"
Example 11-3, "Scope of PL/SQL Exceptions"
Example 11-9, "Reraising a PL/SQL Exception"
Example 12-6, "Using Rollbacks with FORALL"
Example 12-9, "Bulk Operation that Continues Despite Exceptions"

Related Topics