Chapter 11. Administering SQL Remote for Adaptive Server

Anywhere

Error reporting and handling

This section describes how errors are reported and handled by the Message

Agent.

Default error handling

The default action taken by the Message Agent when an error occurs is to record the fact in its log output. The Message Agent sends log output to a window or a log file recording its operation. By default, log output is sent to the window only; the -ooption sends output to a log file as well.

The Message Agent may print more information in the output log than in the window. The Message Agent log includes the following:

Listing of messages applied.

Listing of failed SQL statements.

Listing of other errors.

UPDATE conflicts are not UPDATE conflicts are not errors, and so are not reported in the Message

errors

Agent output.

 

For more information on the log file, see “The Message Agent” on

 

page 292.

Ignoring errors

There may be exceptional cases where you wish to allow an error encountered by the Message Agent when applying SQL statements to go unreported. This may arise when you know the conditions under which the error occurs and are sure that it does not produce inconsistent data and that its consequences can safely be ignored.

To allow errors to go unreported, you can create a BEFORE trigger on the action that causes the known error. The trigger should signal the REMOTE_STATEMENT_FAILED SQLSTATE (5RW09) or SQLCODE (-288) value.

For example, if you wish to quietly fail INSERT statements on a table that fail because of a missing referenced column, you could create a BEFORE INSERT trigger that signals the REMOTE_STATEMENT_FAILED SQLSTATE when the referenced column does not exist. The INSERT statement fails, but the failure is not reported in the Message Agent log.

245

Page 263
Image 263
Sybase DC38133-01-0902-01 manual Error reporting and handling, Default error handling, Ignoring errors, Agent output