Diagnostic Tools
Diagnostic tools in 602SQL allow you to obtain detailed information on errors. They serve the following purposes:
- Find and eliminate errors when debugging an application.
- Respond correctly to an exception in an application.
The first step is to catch an error using the handler. You can use the following inside a handler:
-
System variable SQLCODE - Contains the 602SQL error number
- System variable SQLSTATE - Contains the sqlstate, a five character error code according to the SQL standard
- System variable @@ERROR_MESSAGE - Contains a text description of the error
- System variable @@LAST_EXCEPTION - Contains an exception name or sqlstate, retains the value even after leaving the handler (unlike SQLSTATE and SQLCODE)
- System variable @@ROLLED_BACK - Equals TRUE when the error is a "rollback exception condition" type and a transaction rollback was executed before the handler
-
Function Active_routine_name - Offers information about routines currently being developed