Debugging routines and triggers in the SQL and XQuery editor

If a DB2® routine or trigger is deployed on a database and is enabled for debugging, you can debug it from the SQL and XQuery editor. In the editor, you highlight an SQL statement that runs the routine or activates the trigger and debug the statement.

Before you begin

The database connection in the SQL and XQuery editor must be to a DB2 for Linux, UNIX, and Windows Version 10.1 Fix Pack 2 and later database. The routine or trigger deployed on the database must have the debugging option enabled. Routines cannot be inline SQL PL routines and the triggers cannot contain inline SQL PL.

About this task

When you debug a routine or trigger from the SQL and XQuery editor, source code is opened in the routine debugger. You can perform debugging operations and view variables.
Note: If the routine or trigger does not have the debugging option enabled, the routine or trigger is run. The results are displayed in the SQL Results view.

Procedure

To debug a routine or trigger in the SQL and XQuery editor:

  1. Open the SQL and XQuery editor.
  2. Enter an SQL statement that runs the routine or activates the trigger. For a routine, you can enter a CALL statement to run the routine. For a trigger, you can enter an SQL statement that updates a table to activate the trigger.
  3. Highlight the SQL statement and click Debug selected SQL statements.

Results

The workbench connects to the database and starts the routine debugger.

What to do next

You can use the debugger to set breakpoints and step through the code.


Feedback