SQL Development
The Code Editor opens ready to edit SQL code.
PL/SQL Development
The Code Editor layout for PL/SQL development is used when a stored object is opened or is being created.
|
TIP:
- Align the Toolbox left or right of the Code Editor (Right Click on the Toolbox).
- Pin/Unpin the Toolbox to allow more editing space.
|
|
Note: Show/Hide PL/SQL Debugger in the Toolbox from the Code Editor toolbar. |
All the tools and features for debugging stored programs can be found inside the PL/SQL Debugger window.
Use the debugger to perform the following functions:
- Run to the end or to the next breakpoint.
- Step over code.
- Step into code, when other procedures are called from the current line.
- Display the execution stack.
- View and modify any variable value.
- Set watch variables.
- Set and remove breakpoint on the fly as the code is executing, except in an anonymous block.
- Stop a running procedure.
- Set an option to either stop execution if an exception occurs, or ignore exceptions.
Requirements
Oracle server connection |
Debugging is functional only when you are connected to an Oracle server via a SQL*Net connection. If you are using a local database, such as Personal Oracle, use the loopback SQL*Net connection to perform interactive debugging. |
Oracle Permissions |
create session
alter session |
Debug on/off |
To watch, evaluate, or modify variables of a stored program:
Compile the program with debug information: Session Menu | Include Debug Info. |
Successful compile |
If the procedure fails to compile, it is displayed in red in DB Navigator. It cannot be debugged. |
Debug
Locals tab |
Use the Locals tab to test the effect of different variable values in your procedure.
Example Scenario: Your procedure performs a computation. Start the procedure, enter a starting value and watch how the procedure handles the result. If you want to see a "what if" computation, enter a new value for the variable in the Locals tab and repeat the procedure.
Note:
- If you see an error such as "Not compiled with debug info" instead of the variable value, you need to recompile the procedure with the Debug information and re-execute it in the debugger to see the value of variables. See Session Menu | Include Debug Info for more information.
- The values in the Locals tab are only populated when the code is running.
- The values of the input parameters cannot be modified in the Locals tab.
- When you evaluate a variable in a current breakpoint, remember that the current breakpoint has not yet been executed.
|
REF CURSOR type variables |
When evaluating/watching a variable of REF CURSOR type, its value is displayed in the following format:
flags:FFF, rowcount:RRR.
RRR determines the number of records fetched so far by the examined cursor.
FFF is a combination of cursor status flags:
%ISOPEN
%FOUND
%NOTFOUND
If the user enters the watched variable names as C1%NOTFOUND, C1%FOUND, C1%ISOPEN, C1%ROWCOUNT, the displayed value is the same as would result from watching the cursor itself. (C1 is the name of the cursor) |
Watches and Breakpoints |
You can set breakpoints and watches at any time before or during a debug session. You do not have to recompile your program after you set breakpoints or watches.
Add/remove breakpoints by clicking in the gutter margin left of the code. For more information, see Edit, Compile And Execute. There is also an icon on the toolbar to toggle on/off breakpoints. For more information, see Code Editor PL/SQL.
When execution of a procedure is paused at a breakpoint, you can evaluate or modify any scalar variable within procedure code. If you change the value of a variable, you can confirm the new value of the scalar variable by evaluating the variable again.
Note:
- You can open multiple editors and set breakpoints in several stored programs simultaneously.
- When you evaluate a variable in a current breakpoint, remember that the current breakpoint has not yet been executed.
- Variable values in the "watch" window are updated only at the breakpoint, so strategically place breakpoints after the watch variable.
- Increasing the number of variables in the watch list may result in slower debugger performance.
|
Make your work with packages, procedures, and functions more efficient and error-free.
Features
Code Explorer:
- Is based on an advanced parsing technique that understands PL/SQL syntax.
- Displays detailed information about a package’s components, such as variables and parameters, their types, structure and cursors.
- Highlights the packaged procedure you are currently in.
- Supports drag-and-drop into the editor.
- Combines information from the specification and body.
- Distinguishes non-published procedures and functions (by icon).
Working with packages
Work with packages is fast and easy in the Code Editor with the integrated Code Explorer.
The Code Explorer graphically displays a tree-structure view of the package currently in the editor. It shows variables, parameters, record structures, types, cursors, and so on.
The tree-view is synchronized with the editing cursor in the code-editing window, so when you click any package component in the tree-view, you can see the corresponding PL/SQL code in the editing window. Likewise, as you move the cursor in the editing window, the tree-view changes to show the object corresponding to the PL/SQL code at the cursor location.
Auto Reparse
PL/SQL parsing occurs when the editor first loads objects, and in the background as the user edits the code. You can also manually trigger a full reparsing (updating of the internal symbol table) at any time by right-click and select Auto Reparse from the shortcut menu. However, when loading a really large script having this option on will slow down SQL Navigator. Hence, to avoid wasting CPU resources, you should turn this option off when editing large scripts.
A graphic representation of the syntax tree of the current source.