This section contains the following topics:
A breakpoint is used to suspend the execution of a PL/SQL program at the row where the breakpoint is set. You can use breakpoints to control the execution and debug the function.
When you run a PL/SQL program, the execution pauses at every row where you set a breakpoint. When the program execution is paused, Data Studio retrieves information about the current program state, such as the values of the program variables.
Perform the following steps to debug a PL/SQL program:
When a row with a breakpoint is reached, monitor the state of the application in the debugger pane, and continue the execution.
Data Studio provides debugging options in the toolbar that helps you step through the debug objects.
You can use the Breakpoints pane to view and manage the currently set breakpoints. From the minimized window panel, click the breakpoint option to open the Breakpoints pane.
The Breakpoints pane lists each breakpoint with the row number and the debug object name.
You can enable or disable all the breakpoints by clicking in the Breakpoints pane. You can enable, disable or remove a specific breakpoint by selecting the breakpoint check box and clicking
,
or
in the Breakpoints pane.
Double-click the required breakpoint in the Breakpoint Info column to locate the breakpoint in the PL/SQL Viewer pane.
Follow the steps to set or add breakpoints on a row:
If the execution of the function does not break or stop the breakpoint during debugging, the breakpoint that is already set will not be validated.
Once a breakpoint is set, you can temporarily disable it by selecting the corresponding check box in the left-side of the Breakpoints pane and clicking at the top of the Breakpoints pane. Disabled breakpoints will be grayed out [
] in the PL/SQL Viewer and Breakpoints pane. To enable a disabled breakpoint, select the corresponding breakpoint (using check box) and click
.
You can remove an unused breakpoint using the same method as that for creating a breakpoint.
In the PL/SQL Viewer tab, open the function in which you want to remove the breakpoint. Double-click in the PL/SQL Viewer to disable the breakpoint. The breakpoint is removed from the work area.
You can also enable or disable breakpoints using the preceding method.
During debugging, if the source code is changed after it is fetched from the server and the debugging is continued, Data Studio displays an error.
You are advised to refresh the object and perform the debug operation again.
If the source code is changed after it is fetched from the server, and if you perform the execution or debug operation with no breakpoint set, then the result of the source code at the server will be displayed on Data Studio. You are advised to refresh before performing debug or execute operation.
Perform the following steps to debug a PL/SQL program using a breakpoint:
An example is as follows:
Rows 11, 12, 13
If there is no input parameter, the Debug Function/Procedure dialog box will not be displayed.
To set NULL as the parameter value, enter NULL or null.
On clicking the Debug button, you will see an arrow pointing to the row where the breakpoint is set. The arrow indicates the row number at which execution will resume from.
You can terminate debugging by clicking from the toolbar, or pressing F10, or select Terminate Debugging from the Debug menu. After the debugging is complete, the function execution proceeds and will not be terminated at any breakpoint.
The Callstack and Variables panes are populated.
The Variables pane shows the current value of variables. Mouse over the variable in the function/procedure also shows the current value of variables.
You can step through the code using Step Into, Step Out or Step Over. For details, see Controlling Execution.
To remove the breakpoint, do the following:
This feature enables the Variable Window and columns to be rearranged. You are able to arrange Variable Window to the following places:
When debugging is finished, the variable window will be minimized even if the variable window is rearranged while debugging. If variable window is rearranged as the Terminal tab or the Result tab, on completion of debugging, the tab should be minimized manually. The position of variable window is maintained after it is rearranged.
System Variables are displayed by default. You can disable the system variables whenever required.
The button is in ON state by default.
When a PL/SQL function or procedure is debugged or executed, the same parameter values are used for the next debugging or execution.
While executing a PL/SQL object, following window is displayed:
For the first time, parameter values are empty. Enter the value as required.
Click OK. The parameter values will be cached. Next time during the query execution/debug same parameter values will be displayed.
Once the specific connection is removed, all the parameter values in cache are cleared.
Data Studio displays the variables which are being monitored in the Monitor Window while debugging.
In the Monitor Window, variables must be added in following ways:
If the value is changed in the variable window, the same would reflect in the monitor window if the variable is monitored and vice versa.
The Monitor window can be dragged to anywhere in the Data Studio window.
In Data Studio, variable information is displayed if the cursor is hovered over that variable during the debugging of PL/SQL functions.
Data Studio provides the option to commit/rollback the PL/SQL query execution result after debugging is finished.
Perform the following steps to enable the rollback function:
Or
Right-click the SQL Terminal window where the PL/SQL function is executed.
Select Debug With Rollback to enable the rollback function after the debugging is complete.
Or
Right-click any PL/SQL function under Functions/Procedure in Object Browser.