Topics in this section include:
A breakpoint is used to stop a PL/SQL program on the line where the breakpoint is set. You can use breakpoints to control the execution and debug the procedure.
When you run a PL/SQL program, the execution stops on each line with a breakpoint set. In this case, 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 line with a breakpoint set is reached, monitor the program state in the Debugging pane, and continue to execute the program.
Data Studio provides debugging options in the toolbar that help you step through the debugging objects.
You can view and manage all breakpoints in the Breakpoints pane. Click the breakpoint option at the minimized pane to open the Breakpoints pane.
The Breakpoints pane lists all lines with a breakpoint set and the debugging object names.
You can enable or disable all the breakpoints by clicking in the Breakpoints pane. In the Breakpoints pane, you can select the breakpoint check box and click
,
, or
to enable, disable or remove a specific breakpoint.
In the PL/SQL Viewer pane, double-click the required breakpoint in the Breakpoint Info column to locate the breakpoint.
Perform the following steps to set or add a breakpoint on a line:
If the function is not interrupted or stopped during debugging, the breakpoint set for the function will not be validated.
Once a breakpoint is set, you can temporarily disable it by selecting the corresponding check box in the Breakpoints pane and clicking at the top of Breakpoints. A disabled breakpoint will be grayed out as
in PL/SQL Viewer and Breakpoints panes. To enable a disabled breakpoint, select the corresponding 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 pane, open the function in which you want to remove the breakpoint. Double-click in PL/SQL Viewer to remove the breakpoint.
You can also enable or disable breakpoints in PL/SQL Viewer using the preceding method.
If you debug an object after changing the source code obtained from the server, Data Studio displays an error.
You are advised to refresh the object and debug it again.
If you change the source code obtained from the server and execute or debug the source code without setting a breakpoint, the result of the source code obtained from the server will be displayed on Data Studio. You are advised to refresh the source code before executing or debugging it.
Perform the following steps to debug a PL/SQL program using a breakpoint:
An example is as follows:
Lines 11, 12, 13
If no parameter is entered, the Debug Function/Procedure dialog box will not be displayed.
To set the parameter to NULL, enter NULL or null.
After clicking Debug, you will see pointing to the line where the breakpoint is set. This line is the first line where the execution resumes.
You can terminate debugging by clicking in the toolbar, or pressing F10, or select Terminate Debugging in the Debug menu. After the debugging is complete, the function execution proceeds and will not be stopped at any breakpoint.
Relevant information will be displayed in Callstack and Variables panes.
The Variables pane shows the current values of variables. If you hover over the variable of a function/procedure, the current value is also displayed.
You can step through the code using Step Into, Step Out or Step Over. For details, see Controlling Execution.
Perform the following operations to remove a breakpoint:
You can arrange the Variables pane and its columns to the following positions:
When debugging is complete, the Variables pane will be minimized regardless of its position. If the Variables pane is moved next to the SQL Terminal or Result tab, you need to minimize the pane after debugging is complete. The position of the Variables pane remains unchanged after it is rearranged.
System variables are displayed by default in the Variables pane. You can disable the display of system variables if necessary.
The button is toggled on 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.
When a PL/SQL object is executed, the following window is displayed.
The Value column is empty upon the first execution. Enter the values as required.
Click OK. The parameter values will be cached. The cached parameter values will be displayed in the next execution or debugging.
Once a specific connection is removed, all the cached parameter values are cleared.
Data Studio displays the variables which are being monitored in the Monitor pane during debugging.
In the Monitor pane, add a variable in the following ways:
If the variable is monitored, its value in the Monitor pane will always be the same as that in the Variables pane.
The Monitor pane can be dragged to anywhere in the Data Studio window.
When debugging a PL/SQL function in Data Studio, you can hover over a variable to view its information.
Data Studio allows committing or rolling back the PL/SQL query result after debugging is complete.
Perform the following steps to enable the rollback function:
Or
Right-click the SQL Terminal pane 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/Procedures in Object Browser.