Stepping through a stored procedure

When a thread is suspended, the step controls can be used to step through the execution of the stored procedure line-by-line (assuming there is one statement per line). While performing a step operation, if a breakpoint or exception is encountered, execution suspends at the breakpoint or exception, and the step operation ends.

Tip: You can use combinations of step into and step return commands to step through multiple calls on a single line.

Step Over

This command allows you to step over to the next line of execution. If the current line is a call to a nested stored procedure or the next line is an indented block of code, then the nested procedure or block of code will be executed as one statement unless a breakpoint was encountered. To execute a step over command:

    Select a stack frame in the Debug view. The current line of execution in that stack frame is highlighted in the editor in the Debug perspective. Do one of the following:

    • Click the Step Over button in the Debug view toolbar.

    • Select Run > Step Over from the workbench menu bar.

    • Press F6.

    The statement on the currently-selected line is executed and execution suspends on the next executable statement.

Step Into

This command allows you to step into the next line or block of SQL code. If the current statement is a stored procedure call, then the next line is the first line of the called stored procedure. To execute a step into command:

    Select a stack frame in the Debug view. The current line of execution in that stack frame is highlighted in the editor in the Debug perspective. Do one of the following:

    • Click the Step Into button in the Debug view toolbar.

    • Select Run > Step Into from the workbench menu bar.

    • Press F5.

Step Return

Step return causes execution to resume at the next line in the parent stored procedure of the current nested stored procedure unless a breakpoint is encountered. If the current stored procedure is the only stored procedure in the call stack, then execution will run to completion or to the next breakpoint. To execute a step return command:

    Select a stack frame in the Debug view. The current line of execution in the selected frame is highlighted in the editor in the Debug perspective. Do one of the following:

    • Click the Step Return button in the Debug view toolbar.

    • Select Run > Step Return from the workbench menu bar.

    • Press F7.

Run to Line

When a thread is suspended, it is possible to resume execution until a specified line is executed. This is a convenient way to suspend execution at a line without setting a breakpoint. To run to a line in the editor, do the following:

  1. In the editor, right-click in the marker bar directly to the left of the line that you want to run to, and select Run to Location from the pop-up menu.

  2. Execution is resumed and suspends just before the specified line is to be executed.