SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
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:
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:
host-id is an identifier that specifies a location in the host language program. For
more information, see the SQL/MP programming manual for your host language.
[ 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
GO TO :host-id pass control to location host-id
CALL :host-id execute host-id (Not COBOL85)
PERFORM :host-id execute host-id (COBOL85 only)