Debugging an ASA Trigger

To watch changes to the current table while you debug an Adaptive Server Anywhere trigger, use the ASA Trigger Rows view.

Before following these steps, you must be connected to the Adaptive Server Anywhere database that contains the trigger.

To view table changes in the ASA Trigger Rows view:

  1. In Database Explorer, expand the Tables folder.

  2. Expand the table where the trigger you want to debug is located.

  3. Expand the Triggers folder and select the trigger you want to debug.

  4. Right-click the selected trigger and choose Edit Trigger.

    The SQL code appears in SQL Editor.

  5. Set a breakpoint in the trigger by double-clicking in the bar to the left of the SQL Editor.

  6. Right-click the trigger in Database Explorer and choose Debug Trigger from the context menu.

    The Modify attributes and launch wizard opens.

  7. Enter a SQL statement in the Run box that causes the trigger to run with the values you want.

    You can enter the SQL manually, or click SQL to use Visual SQL.

  8. Click Debug.

    The perspective switches to Database Debug, and the trigger executes up to the breakpoint.

  9. Choose Window|Show View|ASA Trigger Rows.

    The ASA Trigger Rows view appears, in the lower left of the Database Debug perspective by default.

The operation in the trigger determines the row(s) you see in ASA Trigger Rows. The row names you see are based on the referencing old and referencing new clauses in the trigger.

Contents of the ASA Trigger Rows view

OperationView contents
UpdateTwo rows:
  • A row that represents the record before the update

  • A row that represents the record after the update

InsertThe inserted row
DeleteThe deleted row

Note

You cannot edit a table while you are debugging a trigger in that table.

Debugging a Procedural Object

Using Visual SQL to Edit a Procedural Object

See "CREATE TRIGGER statement" in Adaptive Server Anywhere SQL Reference

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com