ALLBASE/SQL Reference Manual (36216-90216)

596 Chapter12
SQL Statements S - Z
WHENEVER
whether or not you use the WHENEVER directive.
This directive cannot be used interactively or with dynamic parameters.
Authorization
You do not need authorization to use the WHENEVER directive.
Example
Execution of the program terminates if the CONNECT TO statement cannot be executed
successfully.
INCLUDE SQLCA
.
.
.
WHENEVER SQLERROR STOP
CONNECT TO '.../sampledb/PartsDBE'
.
.
.
If a row does not qualify, control is passed to the statement labeled 9000.
INCLUDE SQLCA
.
.
.
WHENEVER NOT FOUND GO TO 9000
SELECT OrderDate
FROM PurchDB.Orders
WHERE OrderNumber = :OrdNum