Use the WHENEVER statement to trap exceptions that occur
during the execution of SQL statements. The WHENEVER statement is
equivalent to placing an exception-checking routine after every SQL
statement.
Syntax
Element
Description
Restrictions
Syntax
label
Statement label to which program control transfers
when an exception occurs
Must exist in the same source-code module.
Language-specific
routine
Name of a user-defined routine (UDR) to be invoked
when an exception occurs
Programs that do not use the WHENEVER statement do
not automatically abort when an exception occurs. Such programs must
explicitly check for exceptions and take whatever corrective action
their logic specifies. If you do not check for exceptions, the program
simply continues running. If errors occur, however, the program might
not perform its intended purpose.
The first keyword that follows
WHENEVER specifies some type of exceptional condition; the last part
of the statement specifies some action to take when the exception
is encountered (or no action, if CONTINUE is specified). The following
table summarizes possible actions that WHENEVER can specify.
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.