Progress
Embedded SQL-92
Guide and Reference
WHENEVER Statement
Specifies actions for three SQL-92 run-time exceptions.
SYNTAX
NOT FOUND
The
NOT FOUND
exception is set when sqlca.sqlcode is set to SQL_NOT_FOUND.SQLERROR
The
SQLERROR
exception is set when sqlca.sqlcode is set to a negative value.SQLWARNING
The
SQLWARNING
exception is set when sqlca.sqlwarn[ 0 ] is set to ’W’ after a statement is executed.STOP
Results in the ESQLC program stopping execution.
CONTINUE
Results in the ESQLC program continuing execution. The default exception is to
CONTINUE
.{ GOTO | GO TO } host_lang_label
Results in the ESQLC program execution to branch to the statement corresponding to the host_lang_label.
EXAMPLESThe first example is a code fragment from the
main
function in sample program 1StatUpd.pc. The complete source for the sample program is listed in "ESQL-92 Sample Programs."
This example is a code fragment from the
dynupd
function in sample program 3DynUpd.pc, which illustrates dynamic processing of an UPDATE statement. The complete source for the sample program is listed in "ESQL-92 Sample Programs."
NOTES
- You can place multiple WHENEVER statements for the same exception in a source file. Each WHENEVER statement overrides the previous WHENEVER statement specified for the same exception.
- Correct operation of a WHENEVER statement with a GOTO host_language_label or a GO TO host_language_label is subject to the scoping rules of the C Language. The host_language_label must be within the scope of all SQL-92 statements for which the action is active. The GO TO or GOTO action is active starting from the corresponding WHENEVER statement until another WHENEVER statement for the same exception, or until end of file.
AUTHORIZATION
None.
SQL COMPLIANCE
SQL-92. Progress Extensions: SQLWARNING exception condition and STOP action.
ENVIRONMENT
Embedded SQL-92 only
RELATED STATEMENTS
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |