The interactions in this eCourse require Javascript to be enabled.
Handling Exceptions: Part 2
previous|next
Syntax
EXCEPTION WHEN exception1 [OR exception2 . . .] THEN statement1; statement2; . . .
Is an optional exception-handling clause that traps any exceptions that have not been explicitly handled
[WHEN exception3 [OR exception4. . .] THEN statement3; statement4; . . .] [WHEN OTHERS THEN statement5; statement6; . . .]
Guidelines for Trapping Exceptions
Begin the exception-handling section of the block with the EXCEPTION keyword. Define several exception handlers, each with its own set of actions, for the block. When an exception occurs, PL/SQL processes only one handler before leaving the block. Place the OTHERS clause after all other exception-handling clauses. You can have only one OTHERS clause. Exceptions cannot appear in assignment statements or SQL statements.
Is one or more PL/SQL or SQL statements
Is the standard name of a predefined exception or the name of a userdefined exception declared within the declarative section