WHENEVER
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Specifies actions for three SQL run‑time exceptions.
Syntax
|
Parameters
- { NOT FOUND | SQLERROR | SQLWARNING }
-
- The
NOT FOUNDexception is set whensqlca.sqlcodeis set toSQL_NOT_FOUND. - The
SQLERRORexception is set whensqlca.sqlcodeis set to a negative value. - The
SQLWARNINGexception is set whensqlca.sqlwarn[ 0 ]is set toWafter a statement is executed.
- The
- { STOP | CONTINUE | GOTO | GO TO }host_lang_label}
-
- The
STOPexception results in the ESQL program stopping execution. - The
CONTINUEexception results in the ESQL program continuing execution. The default exception is toCONTINUE. -
GOTO|GOhost_lang_label results in the ESQL program execution to branch to the statement corresponding to the host_lang_label.
- The
Notes
- You
can place multiple
WHENEVERstatements for the same exception in a source file. EachWHENEVERstatement overrides the previousWHENEVERstatement specified for the same exception. - Correct operation of a WHENEVER statement with a
GOTOhost_language_label or aGO TOhost_language_label is subject to the scoping rules of the C Language. The host_language_label must be within the scope of all SQL statements for which the action is active. TheGO TOorGOTOaction is active starting from the correspondingWHENEVERstatement until anotherWHENEVERstatement for the same exception, or until end of the file.
Example
|
|