Code Templates
Modules, Windows And Dialogs > Code Templates
Insert ready-made code segments into any active editor window.
|
Insert code from a template into an active editor window. |
- In the editor, place the cursor where you want to insert the code segment.
- Choose one of the following:
- Type the shortcut key to the code template.
- Type the full or partial name of the code template and press Ctrl+J to either insert the matching code template or select from a list of matches.
- Press Ctrl+J. Select the template name from the drop-down list and press Enter.
|
|
Add / Edit / Delete code templates. |
Click View | Code Templates | Edit Code Templates. This opens the Code Shortcuts And Templates Dialog
Each template is a file in the SQL Navigator installation Templates directory.
The maximum number of templates allowed, including preformatted templates, is 100. |
Standard code routines for which templates have been provided:
|
Basic Loop Statement |
Shift+Ctrl+L |
|
Boolean Statement |
Shift+Ctrl+B |
|
Close Cursor Statement |
Shift+Ctrl+C |
|
DBMS_OUTPUT.Put_Line |
Shift+Ctrl+D |
|
Exception |
Shift+Ctrl+E |
|
Exit When Statement |
Shift+Ctrl+X |
|
For Loop Statement |
Shift+Ctrl+F |
|
GOTO Label Statement |
Shift+Ctrl+G |
|
IF Statement |
Shift+Ctrl+A |
|
MLSLABEL Statement |
Shift+Ctrl+M |
|
Number Statement |
Shift+Ctrl+N |
|
Open_Cursor Statement |
Shift+Ctrl+O |
|
Raise_Exception |
Shift+Ctrl+R |
|
SQLCODE Statement |
Shift+Ctrl+S |
|
VARCHAR2 Statement |
Shift+Ctrl+V |
|
Variable_name |
Shift+Ctrl+T |
|
While Condition Statement |
Shift+Ctrl+W |
Code Shortcuts And Templates Dialog
Modules, Windows And Dialogs > Code Templates > Code Shortcuts And Templates Dialog
Create your own code templates. Edit or delete existing code templates. Change the shortcut key definitions attached to a template.
|
Templates |
Click on a template to select it.
|
Name |
The name of the template. A template name is a single word with no spaces.
You cannot change a template name. Instead, you can delete an existing template and create another like it with a different name. |
|
Description |
A short description of the template.
Click in the Description field to edit it. |
|
Shortcut key |
The shortcut key combination used to insert the template code into an editor.
Click in the field to change the Shortcut key. Select from those available. To have no shortcut key select None. | |
|
Code |
View / Edit the SQL code for the selected template. |
|
Add |
Create a new template. |
|
Delete |
Delete the selected template.
You cannot delete all the templates. There must be at least one template remaining in the Code Shortcuts and Templates dialog. |
Default Templates
|
Basic Loop |
Basic Loop Statement |
LOOP
statements;
END LOOP; |
SHIFT+CTRL+L |
|
Boolean |
Boolean Statement |
Boolean; |
SHIFT+CTRL+B |
|
Close Cursor |
Close Cursor Statement |
CLOSE cursor_name; |
SHIFT+CTRL+C |
|
DBMS_PutLine |
DBMS_OUTPUT.Put_Line |
DBMS_OUTPUT.Put_Line(string); |
SHIFT+CTRL+D |
|
Exception |
Exception Statement |
EXCEPTION
WHEN exception_name THEN
statements;
WHEN no_data_found THEN
statements;
WHEN others THEN— Handles all exceptions
statements; |
SHIFT+CTRL+E |
|
Exit_When |
Exit When Statement |
EXIT WHEN condition_is_true ; -- To exit loop |
SHIFT+CTRL+X |
|
For_Loop |
For Loop Statement |
FOR J IN 1..12 LOOP
statements;
END LOOP; |
SHIFT+CTRL+F |
|
GOTO_Label |
GOTO Label Statement |
GOTO label_name ; |
SHIFT+CTRL+G |
|
IF |
IF Statement |
IF condition_is_true THEN
statements; |
SHIFT+CTRL+A |
|
MLSLABEL |
MSLABEL Statement |
MSLABEL; |
SHIFT+CTRL+M |
|
Number |
Number Statement |
NUMBER( precision , scale ), |
SHIFT+CTRL+N |
|
Open_Cursor |
Open_Cursor Statement |
OPEN cursor_name ; |
SHIFT+CTRL+O |
|
Raise_Exception |
Raise_Exception |
RAISE exception_name ; |
SHIFT+CTRL+R |
|
SQLCODE |
SQLCODE Statement |
SQLCODE; |
SHIFT+CTRL+S |
|
VARCHAR2 |
VARCHAR2 Statement |
VARCHAR2( size ), |
SHIFT+CTRL+V |
|
Variable_name |
Variable_name |
variable_name ColName%TYPE; |
SHIFT+CTRL+T |
|
While_Condition |
While Condition Statement |
WHILE condition_is_true LOOP
statements;
END LOOP ; |
SHIFT+CTRL+W |
|
Unassigned |
|
|
SHIFT+CTRL+H |
|
Unassigned |
|
|
SHIFT+CTRL+J |
|
Unassigned |
|
|
SHIFT+CTRL+K |
|
Unassigned |
|
|
SHIFT+CTRL+P |
|
Unassigned |
|
|
SHIFT+CTRL+Q |
|
Unassigned |
|
|
SHIFT+CTRL+Y |
|
Unassigned |
|
|
SHIFT+CTRL+Z |
Code Test
Modules, Windows And Dialogs > Code Test
The Code Test panel automates the process of testing PL/SQL programs.
To open the Code Test module
- Open a procedure or function to test in the Code Editor.
- Click Tools | Code Test
- All test cases currently defined for the procedure / function are displayed. Packages are grouped by entry point.
|
Open and Select Object |
Opens the Select DB Object Dialog. |
|
Refresh |
Refresh the list of test cases against the current object. |
|
Create New Test Case |
Opens Test Case Properties. Create a new test case.
The first time you create a test case, you are prompted to install the Code Tester for Oracle repository. Installation of this repository is required. Complete the wizard that is launched. |
|
Edit Test Case |
Opens Test Case Properties. Includes the properties of the highlighted test case. |
|
Clone Test Case |
Opens Test Case Properties. Renames the test case. Includes the properties of the highlighted test case. |
|
Run Selected Test Cases |
Runs the selected test cases.
Test Case Selected
Test Case Not Selected
As test cases are run, the status of each is shown. |
|
|
TIP:
- Right click on the test case for further options.
- Use the search facility to search for test cases by name or parameter.
- Test cases created in SQL Navigator can also be used in Code Tester for Oracle.
|
Test Case Properties
Modules, Windows And Dialogs > Code Test > Test Case Properties
You describe the expected behavior of a program and then SQL Navigator generates the required code for the test case.
| Test Name |
The name of the test case selected or a new name. This field is editable. |
| Parameter, Input & Expected Output |
Configure input parameters and expected outputs. |
| Test & Result |
|
|
Exception Outcome |
| No Exception |
Select if you do not expect the test to raise an exception. |
| Exception Expected |
Select if you expect the test to raise an exception.
Fill in the expected Error Code as a number. | |
|
Elapsed Time Outcome |
| Check |
Select to test the time taken to execute the code. |
| Time (ms) |
The maximum time allowed for the code to complete execution (in milliseconds). | |