Error Handling and Recovery (Application Requirements)

From InterBase
Jump to: navigation, search

Go Up to Application Requirements


Every time a SQL statement is executed, it returns an error code in the ­SQLCODE variable. SQLCODE is declared automatically for SQL programs during preprocessing with gpre. To catch run-time errors and recover from them when possible, SQLCODE should be examined after each SQL operation.

SQL provides the WHENEVER statement to monitor SQLCODE and direct program flow to recovery procedures. Alternatively, SQLCODE can be tested directly after each SQL statement executes. For a complete discussion of SQL error handling and recovery, see Error Handling and Recovery.