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
WHENEVERbranching by inserting aWHENEVERSQLERRORCONTINUEstatement. The program now ignoresSQLCODE. - Use a
SQLCODE-checking statement to check for a particularSQLCODEand direct the program to an alternative procedure. - To return to
WHENEVERbranching, insert a newWHENEVERstatement.
Where portability is not an issue, additional information may be available in the InterBase status array.