Error Reporting and Handling
Go Up to Error Codes and Messages
For reporting and dealing with errors, InterBase utilizes the SQLCODE variable and InterBase codes returned in the status array.
Every executable SQL statement sets the SQLCODE variable, which can serve as a status indicator. During preprocessing, gpre declares this variable automatically. An application can test for and use the SQLCODE variable in one of three ways:
- Use the
WHENEVERstatement to check the value ofSQLCODEand direct the program to branch to error-handling routines coded in the application. - Test for
SQLCODEdirectly. - Combine
WHENEVERand directSQLCODEtesting.
For SQL programs that must be portable between InterBase and other database management systems, limit error-handling routines to one of these methods.
The InterBase status array displays information about errors that supplements SQLCODE messages.
InterBase applications can check both the SQLCODE message and the message returned in the status array.
Topics
- Trapping Errors with WHENEVER
- Checking SQLCODE Value Directly
- InterBase Status Array
- For More Information