Error Handling (Language Reference Guide)
Go Up to SQL Statement and Function Reference
Every time an executable SQL statement is executed, the SQLCODE
variable is set to indicate its success or failure. No SQLCODE
is generated for declarative statements that are not executed, such as DECLARE CURSOR
, DECLARE TABLE
, and DECLARE STATEMENT
.
The following table lists values that are returned to SQLCODE
:
SQLCODE | Message | Meaning |
---|---|---|
< 0 |
|
Error occurred; statement did not execute |
0 |
|
Successful execution |
+1–99 |
|
System warning or informational message |
+100 |
|
No qualifying rows found, or end of current active set of rows reached |
When an error occurs in isql
, InterBase displays an error message.
In embedded applications, the programmer must provide error handling by checking the value of SQLCODE
.
To check SQLCODE
, use one or a combination of the following approaches:
- Test for
SQLCODE
values with theWHENEVER
statement. - Check
SQLCODE
directly. - Use the
isc_print_sqlerror
( ) routine to display specific error messages.
For more information about error handling, see the Embedded SQL Guide.