NOT FOUND
identifies any exception condition that results in a return code of +100 in SQLCODE, (or +1403 in Version 5 compatibility mode).
SQLERROR
identifies a condition that results in a negative return code.
SQLWARNING
identifies a non-fatal warning condition.
CONTINUE
indicates that the program should progress to the next statement.
GOTO
indicates that the program should branch to the statement named by label_name.
STOP
DO
indicates that the program should call a host language routine. The syntax of routine_call depends on your host language. See your language-specific Supplement to the Oracle Precompilers Guide.
The scope of a WHENEVER statement is positional, rather than logical. A single WHENEVER statement applies to all embedded SQL statements that physically follow it in the Precompiler source file, not in the flow of the program logic. A WHENEVER statement remains in effect until it is superseded by another WHENEVER statement checking for the same condition.
For more information on this command, see Programmer's Guide to the Oracle Precompilers.
Do not confuse the WHENEVER embedded SQL command with the WHENEVER SQL*Plus command.
Example
The example illustrates the use of the WHENEVER command in a Pro*C embedded SQL program:
EXEC SQL WHENEVER NOT FOUND; ... EXEC SQL WHENEVER SQLERROR GOTO sqlerror: ... sql_error: EXEC SQL WHENEVER SQLERROR CONTINUE; EXEC SQL ROLLBACK RELEASE;