Debugging a Trigger

Debug a trigger using the Sybase WorkSpace debugging tools.

Prerequisites You must be connected to the database that contains the trigger you want to debug. Do not attempt to edit a table while you are debugging a trigger in that table.
Note: When you are debugging a trigger, the table on which the trigger is defined is accessible only at isolation level 0. To be accessible at isolation level 0, the table must have a unique index. Therefore, to be displayed in the Referenced Tables view in the Database Debug perspective, the trigger table must have a unique index. If the table does not have a unique index, you may receive an error message like the following: The optimizer could not find a unique index, which it could use to perform an isolation level 0 scan on table <table_name>
  1. In the Databases folder in Enterprise Explorer, under the database connection profile, expand the navigation tree for the appropriate database and schema owner.
    Database Steps
    From an ASE connection profile
    1. Expand the Databases folder.
    2. Expand the tree for a database and then the tree for the appropriate schema owner.
    From a SQL Anywhere or Sybase IQ connection profile
    1. Expand the tree for a database.
    2. Expand the Schemas folder and then the tree for the appropriate schema owner.
  2. Expand the Tables folder and then theTriggers folder.
  3. Find the trigger you want to debug, right-click the trigger, and choose Edit.

    The Trigger Editor opens.

  4. In the Source tab, set a breakpoint in the trigger by double-clicking in the bar to the left of the SQL code.
  5. Right-click in the content window, choose Debug from the context menu.

    The Edit configuration and launch wizard opens.

  6. In the Run box, enter a SQL statement that causes the trigger to run with the values you want.

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

  7. Click Debug.

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

  8. Debug the trigger using step-in, step-over, or resume in Debug.
Related tasks
Debugging a Procedural Object
Dumping Debug Variables and Referenced Table Data
Debugging a Table in Referenced Tables View
Debugging an External Client
Related reference
SQL Anywhere Trigger Rows View


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com