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:

  1. Override the WHENEVER branching by inserting a WHENEVER SQLERROR CONTINUE statement. The program now ignores SQLCODE.
  2. Use a SQLCODE-checking statement to check for a particular SQLCODE and direct the program to an alternative procedure.
  3. To return to WHENEVER branching, insert a new WHENEVER statement.

Where portability is not an issue, additional information may be available in the InterBase status array.

Advance To: