Toad for Oracle
Parameter Hints
When you enter parameters for a procedure or function call, parameter help is available in a pop-up tooltip. The parameter hint automatically displays when you pause after typing the open parenthesis following the procedure call. It will display as long as the procedure reference can be resolved. When you enter in the parameter values, the current parameter will be highlighted in the tooltip.
The parameter hint pop-up will close when you do one of the following:
• Press <ESC>
• Type the closing parenthesis
• Move the cursor to the left of the open parenthesis
• Enter more parameters than expected
If the procedure is overloaded, you can cycle through the overloads by pressing
<UP> and <DOWN>.
Using the Procedure Editor
Navigating through the Procedure Edit window is similar to navigating through the SQL Edit window.
Main ways to get code into the Procedure Editor
• Read from file
• Load from existing object from database
• Create new Procedure Editor dialog
• Type/Paste from scratch
• Drag and Drop from File Explorer
• Select procedure or trigger in Schema Browser and click Load In
Procedure Editor button (the Procedure Editor window button on the objects panel).
The F9 key compiles and then stores the code in the database.
136
Procedure Editor
Java source can be loaded and compiled in the Procedure Editor.
If you have the PL/SQL Debugger and click in the gutter of the Procedure
Editor, a breakpoint is created. So, when selecting text with the mouse drag the selector within the text area.
To Open a Procedure Using File | Open
1.
While in the Proc Edit window, Go to File | Open File.
2.
The Load File window will display.
3.
Select file(s) and click Open.
To Load Object from a database
1.
Click the Load Object from database button.
2.
The Load Database Object window will display.
3.
Select the desired schema and object type from the dropdown lists.
4.
You can filter using object types and a starts with, includes, ends with filter.
5.
To preview the source for an object, select the object from the object list. Or, double-click on an object name to load it directly into the
Procedure Editor.
6.
The selected object's SQL script is displayed in the SQL script area of the Load Database Object window. You can toggle the auto preview button that's at the top of the dialog to turn the auto preview on and off.
7.
Click OK.
The script is opened in the Procedure Editor, and the Load Database Object window closes automatically.
The filter button on the Load Database Object window shows and hides the four widgets for filtering. If you hide the widgets, you have more area for the grid.
To Create an Object using the New PL/SQL Object button
1.
Click the Create New PL/SQL object toolbar button.
2.
The New PL/SQL Object Options window displays.
3.
Select an object type from the dropdown list.
4.
Click in the Object Name textbox and type in an object name.
5.
Click OK.
6.
The template script with your object name is pulled into the
Procedure Editor.
137
Toad for Oracle
The default templates are NewProc.sql for a procedure, NewFunc.sql for a function, NewPackage.sql, NewPackageBody.sql, NewPkgFunc.sql for a package function, NewPkgProc.sql for a package procedure, NewTypeFunc.sql for an object member function, NewTypeProc.sql for an object member procedure,
NewType.sql for an object type spec, NewTypeBody.sql for an object type body, and NewTrig.sql for triggers. You can edit the templates to create a common starting point for new stored procedures.
There is also an option in the View | Options | Editors page to load the templates from the network if you elected to install Toad to a network server share.
You configure templates on the View | Options | Procedure Editor | Proc
Templates page.
Toad will automatically substitute values for keywords in the templates. Toad will perform the following substitutions.
Object Name: %YourObjectName% or *YourObjectName*
Sysdate: %SYSDATE%
Date/Time: %DATETIME%
Date: %DATE%
Time: %TIME%
Username: %USERNAME% (set in Toad Options, Procedure Editor)
Trigger Options: %TriggerOpts%
For example, this template:
/* Object Name: %YourObjectName% */
/* Date:%DATE% */ is translated into:
/* Object Name: My_Proc_Name */
/* Date: 2/15/2005 */
138
Procedure Editor
Toad can substitute variables in the code completion templates. If you have substitution variables in your code completion templates, then after you enter the code completion keystroke, Toad prompts you for the substitution variable.
The left panel contains the navigator tree, a list of objects or package contents.
Each package is composed of a Specification (SPEC) and/or Body, which is displayed in the hierarchy on the list. You can right-click in the tree and select what you want to display. Functions are in indicated with an f ( ) and procedures are indicated with a p( ). The navigator tree represents nested procedures. It can also display the following declarations: constants, cursors, exceptions, parameters, PL/SQL tables, records, record fields, ref cursors, subtypes, system types, variables, and Varrays.
Click on an item and it goes to that item in the code.
The upper right panel in the Procedure Editor contains the code for the selected object. You can have several procedures open. Each procedure will open in a separate tab. When you open a package in the Procedure Editor the spec and body will open in separate tabs unless you choose for them to open in the same tab through the Options | Procedure Editor | File Splitting page.
Compiling will be disabled for files that are not split.
The Error panel lists errors on the left in a list box and details on the right.
Single-click on an error in the list to display the details and the error will highlight in the editor. Double-click on an error to invoke the Instant Messages screen for that Oracle error.
139