Error Handling

To strengthen error handling, you should consider embedding the SQL WHENEVER directive in your source code. The WHENEVER directive is used to direct program logic when the application encounters a warning or an error. You can choose to ignore errors or redirect them with WHENEVER.

The default behavior of AcuSQL is to attempt to ignore warnings and error conditions, and continue processing, if possible. Your application can either explicitly check error conditions or, for more automatic error processing, use the WHENEVER directive. Your application can contain more than one WHENEVER directive. A WHENEVER directive applies to all embedded ESQL statements that follow it, until it is superseded by another WHENEVER directive.

Use the WHENEVER directive to specify what actions the program takes when it encounters one of the following conditions:

Specify one of the following actions when an error condition occurs:

Syntax

EXEC SQL WHENEVER {SQLERROR}   | {CONTINUE}
                  {SQLWARNING} | {PERFORM paragraph}
                  {NOT FOUND}  | {GO TO paragraph}
                               | {STOP}

where paragraph is a specified procedure in the program.

See WHENEVER Directive for an example of the WHENEVER directive.