Developing and debugging PL/SQL anonymous blocks

You can write a PL/SQL anonymous block statement in the SQL and XQuery editor and debug it.

Before you begin

Ensure the following are created:
  • A connection to a DB2 for Linux, UNIX, and Windows v10.1 Fix Pack 2 or later database that supports PL/SQL.
  • A data development project where you open the SQL and XQuery editor.
Note: Debugging PL/SQL anonymous block is supported only on DB2® for Linux, UNIX, and Windows Version 10.1 Fix Pack 2 and later databases.

About this task

A PL/SQL anonymous block statement is an executable statement that can contain PL/SQL control statements and SQL statements. It can be used to implement procedural logic in a scripting language. In PL/SQL contexts, this statement can be compiled and executed by the DB2 data server. For information about anonymous blocks, see Anonymous block statement (PL/SQL).

Procedure

To develop and debug a PL/SQL anonymous block:

  1. Open the SQL and XQuery editor.
  2. Enter anonymous block statement text in the SQL and XQuery editor.
  3. To debug the anonymous block, highlight the text and click Debug selected SQL statement

Results

The workbench connects to the database and starts the debugger.

What to do next

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

You can save the anonymous block as an SQL script. To debug the anonymous block that is in a file, open the file in the SQL and XQuery editor, highlight the anonymous block file, and click Debug selected SQL statement.


Feedback