Checking SQLCODE Value Directly
From InterBase
Go Up to Error Reporting and Handling
Applications can test directly for a particular SQLCODE
after each SQL statement. If that SQLCODE
occurs, the program can branch to a specific routine.
To handle specific error situations, combine checking for SQLCODE
with general WHENEVER
statements. These steps outline the procedure, which is described in detail in the Embedded SQL Guide:
- Override the
WHENEVER
branching by inserting aWHENEVER
SQLERROR
CONTINUE
statement. The program now ignoresSQLCODE
. - Use a
SQLCODE
-checking statement to check for a particularSQLCODE
and direct the program to an alternative procedure. - To return to
WHENEVER
branching, insert a newWHENEVER
statement.
Where portability is not an issue, additional information may be available in the InterBase status array.