Trapping Errors with WHENEVER
Go Up to Error Reporting and Handling
The WHENEVER
statement traps SQL errors and warnings. WHENEVER
tests SQLCODE
return values and branches to appropriate error-handling routines in the application. Error routines can range from:
- Simple reporting of errors and transaction rollback, or a prompt to the user to reenter a query or data.
- More sophisticated routines that react to many possible error conditions in predictable ways.
WHENEVER
helps limit the size of an application, since it can call on a single suite of routines for handling errors and warnings.