NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
W-1
W
WHENEVER DIRECTIVE
WHENEVER is a host program directive that specifies an action to take when an error,
warning, or no-rows-found condition occurs.
{ NOT FOUND }
{ SQLERROR }
{ SQLWARNING }
specifies a condition to test for, as follows:
SQL tests for the condition after each DCL, DDL, and DML statement for which the
WHENEVER directive is in effect. (To end testing, specify WHENEVER with the
same condition, but no action.)
In a SELECT through a cursor, NOT FOUND means no rows or all rows qualify. In
statements with a WHERE clause, NOT FOUND means no rows satisfy the
WHERE clause. In a FETCH after a series of fetches, NOT FOUND means all rows
were fetched.
[ CONTINUE ]
[ GOTO :host-id ]
[ GO TO :host-id ]
[ CALL :host-id ]
[ PERFORM :host-id ]
specifies the action to take, as follows:
[ CONTINUE ]
{ NOT FOUND } [ GOTO :host-id ]
WHENEVER { SQLERROR } [ GO TO :host-id ]
{ SQLWARNING } [ CALL :host-id ]
[ PERFORM :host-id ]
NOT FOUND A no-rows-found condition (SQLCODE 100)
SQLERROR An error (a negative SQLCODE value)
SQLWARNING A warning (a positive SQLCODE value other than
100)
CONTINUE
continue with next statement
GOTO :host-id pass control to location host-id