< Previous | Next >

Debugging the stored procedure

The workbench includes an integrated stored procedure debugger. By stepping through your code while you are running in debug mode and viewing the results, you can discover problems with your stored procedure and make the necessary changes.

The stored procedure debugger supports debugging SQL or Java stored procedures, with some limitations depending on your operating system and DB2 version. See the stored procedure debugger help topics in the information center for more details.

When you debug routines that you deploy to a local database such as the GSDB database, you do not need to set up the built-in debug session manager. However, before you debug routines that you deploy to a database on a server, you must set up the server and the session manager. The setup process is described in help topics in the information center.

To debug the stored procedure:

  1. In the Data Project Explorer view, right-click the stored procedure, and then select Debug. The Specify Parameter Values window opens.
  2. In the Value field, type 018. 018 is the ID for an organization (EMP_EMPLOYEE_DIM.ORGANIZATION_CODE) in the EMP_EMPLOYEE_DIM table. When you enter this value, the stored procedure will return rows that match this organization ID.
  3. Click OK. A prompt asks if you want to switch to the Debug perspective. Click Yes
  4. In the Debug perspective, set line breakpoints in the stored procedure by double-clicking in the left vertical margin of the Routine Debugger view.
  5. From the Run menu, select Resume, Step into, or Step over to run in debug mode.
  6. Continue running in debug mode until the results appear in the SQL Results view.
You can return to the IBM SQL and Routine Development perspective by clicking the Arrow button button in the top-right corner of the workbench and then selecting IBM SQL and Routine Development .
< Previous | Next >

Feedback