Chat now with support
Chat with Support

Toad for Oracle 13.1.1 - Getting Started Guide

Welcome to Toad Toad Resources Required Privileges Create and Manage Database Connections Editor Basics Schema Browser Basics Data Grid Basics Work with Data Work with Database Objects Work with Code
Write Statements and Scripts Work with the Query Builder Execute Statements and Scripts Save Statements (SQL Recall) Work with PL/SQL Objects Debug Analyze Code Optimize SQL
Customize your Toad Environment Use Other Quest Software Products with Toad

About Debugging

Work with Code > Debug > About Debugging

You can debug PL/SQL and SQL scripts in Toad.

Notes:

  • There are minimum Oracle database requirements for using this feature. Minimum Oracle Requirements for Debugging
  • The debugger is not designed to work with word-wrapped lines, since the Editor will then have a different set of line numbers than what is stored in Oracle. Toad provides a warning message about this if you open the procedure Editor while word-wrapping is enabled. To disable word-wrap, select View | Toad Options | Editor | Behavior and clear Word wrap.
  • To avoid modifications to code that is being debugged, Toad does not allow you to run a query while you are running a debugging session.

Types of Debugging

Toad provides the following debug features:

Debug type Description
DBMS Debugger

Debugs PL/SQL. Using the Debugger, you can set breakpoints, watches, and see call stacks. In addition, you can view DBMS output.

Note: When using the PL/SQL Debugger and connecting to a RAC instance, you must have the TNSNAMES entry for the instance with the server directed the use connection or session here. Or, you must connect directly to an instance of the cluster without letting the server assign an instance.

JDWP Debugger Toad also provides a JDWP debugger for debugging PL/SQL. You must configure the JDWP Debugger prior to initial use. See Configure JDWP Debugger for more information. To use the JDWP debugger, select Debug | JDWP Debugger.
Script Debugger

Debugs SQL scripts. You can set breakpoints, run to cursor, step over, trace into, and halt execution of your scripts.

Attach External Session External debugging allows you to debug PL/SQL that is run from an external session, such as another Toad window, SQL*Plus, or any other development tool which calls Oracle stored procedures.

Debugging in Toad requires you to select one type of debugging at a time for all database instances open per instance of Toad. For example, if you have three database connections in one instance of Toad, they must all be in the same debugging state. If you then opened another instance of Toad, with the same or different connections, they could be in a different debugging state.

Compile with Debug Information

To use the debugger fully with PL/SQL or Java packages, you need to compile your object with debug information. Start Debugging

In addition, if you are debugging an object that has dependent objects, you cannot step into the dependents unless they, too, are compiled with debug information. Handle Dependencies and References

Compile without Debug Information

To reduce the size of your code when it is ready for production, you should compile without debug information. Prepare PL/SQL Code for Production.

Get more information on Debugging

  • Toad's online help includes tutorials on how to debug. See Debugging a Procedure or Function Tutorial in the online help for more information.
  • See the Debug section of the Table of Contents in the online help for additional topics on debugging.

 

Debug PL/SQL

Work with Code

Toad provides an intuitive and efficient way to write, run, and test your SQL and PL/SQL code. Toad supports efficient code management for a single developer or a whole team of developers.

 

Minimum Oracle Database Requirements

Work with Code > Debug > Debug PL/SQL > Minimum Oracle Database Requirements

For all databases, you must have the Oracle Probe API v2.0 or later installed in order to debug PL/SQL using Toad.

To check the Oracle Probe API version

  1. Make sure a package called DBMS_DEBUG exists in the SYS schema.
  2. To find out what version of the Probe API you have, run the following anonymous PL/SQL block in the SQL editor with a DBMS Output window tab selected:

    declare

    probe_major_ver varchar2(10);

    probe_minor_ver varchar2(10);

    begin

    dbms_debug.probe_version(probe_major_ver, probe_minor_ver);

    dbms_output.put_line('MAJOR='| | probe_major_ver);

    dbms_output.put_line('MINOR='| | probe_minor_ver);

    end;

    If the DBMS Output window displays:

    MAJOR=2

    MINOR=2

Then the version of Oracle Probe API is 2.2.

Database Version Notes

You must have the DEBUG CONNECT SESSION privilege, or Oracle will not let you use DBMS_DEBUG.

Additional notes

  • You cannot use the Evaluate/Modify window to change argument values.
  • Watches on package variables are only allowed for Probe v2.2 or higher.

 

Start Debugging

Work with Code > Debug > Debug PL/SQL > Start Debugging

You debug PL/SQL objects in the Editor.

When you open a complete package or type in the Editor, the spec and body open in separate tabs by default. However, Toad provides options to control how objects are split, reassembled, and saved. See Editor Open/Save Options in the online help for more information.

To use the debugger fully with PL/SQL or Java packages, you need to compile your object with debug information. You cannot step into code or step over unless the object was compiled with debug. You can only execute. In addition, if you are debugging an object that has dependent objects, you cannot step into the dependents unless they, too, are compiled with debug information.

To start debugging

  1. Open a PL/SQL object in the Editor.
  2. Click on the main toolbar or select Session | Toggle Compiling with Debug. This enables debugging.
  3. Compile the object on the database.
  4. Select one of the following actions on the Execute toolbar to begin debugging:
    • - Click to Execute PL/SQL with debugger
    • - Click to Step over
    • - Click to Step into
    • - Click to Run to cursor

 

Related Documents