SQL Programming Manual for TAL
HP NonStop SQL Programming Manual for TAL—527887-001
6-1
6 Error and Status Processing
NonStop SQL returns error and status information to an application program following
the execution of each embedded SQL statement. NonStop SQL returns some
information to the integer SQLCODE variable and more extensive information to these
data structures:
•
SQL communications area (SQLCA). The SQLCA contains run-time information
including errors and warnings generated by the most recently executed dynamic or
static SQL statement.
•
SQL descriptor area (SQLDA). The SQLDA contains information about input
parameters and output variables in dynamic SQL statements.
•
SQL statistics area (SQLSA). The SQLSA contains statistics and performance
information after the execution of DML and some dynamic SQL statements.
This section describes how to check the SQLCODE variable and the SQL data
structures to get information about:
•
Errors and warnings after the execution of SQL statements
•
Performance and statistics after the execution of SQL statements
•
Dynamic SQL operations
Getting Error and Warning Information
NonStop SQL provides these methods you can use to check for and process errors
and warnings in your program:
•
Checking the value of the SQLCODE variable
•
Using the WHENEVER directive
•
Checking information in the SQLCA
Using the SQLCODE Variable
NonStop SQL returns status to the SQLCODE variable after the execution of each
embedded SQL statement. The SQLCODE variable can have these values:
Each NonStop SQL message has an assigned code number that is returned to
SQLCODE. For the values for SQLCODE and their meanings, see the
SQL/MP
Messages Manual.
Value Status
< 0 Error
> 0 Warning
0 Successful