Stepping through Code

When a breakpoint is encountered and control is passed to the debugger, use the following debug commands to resume execution or step through the code line-by-line. Control returns to the debugger after the specified set of statements have been executed.

Use If you want to do this...
Step Into Execute the next statement (descend into subprogram calls). Step Into at the end of a trigger will cause the debugger to stop at the next line of PL/SQL.
Step Over Execute the next statement without stepping into a nested subprogram call. Step Over at the end of a trigger will also cause the debugger to enter the event loop.
Step Out Resume execution to the next executable statement in the calling program (nested subprogram calls are completed). Step Out at the end of a trigger will cause the debugger to enter the event loop.
Run to Cursor Resume execution to the source line specified by the cursor.
Go Resume execution until the program terminates normally or is interrupted by the next breakpoint.
Pause Suspend execution at its current location. If the application is executing PL/SQL, the PL/SQL Editor opens and displays the source unit at which the pause occurred.
Stop Terminate debugging and program execution completely.

Execute these commands from either the Debug menu or the Debug toolbar buttons. The Run to Cursor command is also accessible from the pop-up menu in the PL/SQL Editor.

Note: The Step commands have the same effect unless the application program contains subprogram calls.

Executing code incrementally enables you to examine the program state at intervals so that you can determine the location of the logical error.

Consider the following module trigger code where execution has suspended and the current execution location is at line 1:

->  do_records;
  do_tables;
  do_objects;

If you choose the Step Into command, the program executes line 1 and descends into the subprogram DO_RECORDS. Execution then breaks at the next executable statement in the subprogram (line 9):

PROCEDURE do_records IS
  TYPE rec1 IS RECORD (
  a NUMBER;
  b VARCHAR2(32) );
  v varchar2(32);
  n number;
  x rec1;
BEGIN
->v := 'Hello World';
  n := 22.5;
  x.a := 1;
  x.b := 'Hello';
END;

At this point, if you place the cursor over line 11 and choose Run to Cursor from the pop-up menu (right-click in Windows), the program executes lines 9 and 10 and positions the pointer on line 11:

...
BEGIN
  v := 'Hello World';
  n := 22.5;
->x.a := 1;
  x.b := 'Hello';
END;

If you choose the Step Out command, the program then resumes execution from line 11, completes executing the subprogram and returns to the calling trigger code:

  do_records;
->do_tables;
  do_objects;

The current execution location is now at line 2 of the Form trigger call. If you choose the Step Over command, the program executes the procedure DO_TABLES without stepping into the body of the procedure. Execution then breaks at line 3 of the form trigger code:

  do_records;
  do_tables;
->do_objects;

If you now choose the command Go, the program resumes execution from line 3, executes the subprogram DO_OBJECTS without descending into the body of DO_OBJECTS, and returns to the module that contains the trigger.


Running to a Cursor Location in the Source Unit

The Debug Toolbar Buttons

The Debug Menu Commands