users guide for sql navigator
TRANSCRIPT
-
7/26/2019 Users Guide for SQL Navigator
1/464
F O R O R A C L E
Users Guide
Version 4
-
7/26/2019 Users Guide for SQL Navigator
2/464
This guide contains proprietary information, which isprotected by copyright. The information in this guide is
subject to change without notice and does not representa commitment on the part of Quest Software. The
software described in this guide is furnished under a
license or nondisclosure agreement. This software may
be used or copied only in accordance with the terms of
this agreement. No part of this guide may be reproduced
or transmitted in any form or by any means, electronic
or mechanical, including photocopying and recording,
for any purpose other than the purchasers personal usewithout the written permission of Quest Software, Inc.
2001 Quest Software, Inc. All Rights Reserved.
SQL Navigator is a trademark of Quest Software, Inc.Other trademarks and registered trademarks used in thisguide are the property of their respective owners.
8001 Irvine Center DriveIrvine, CA 92618USA
www.quest.com
U.S and Canada: 949 754.8000UK: +44.1628.601000Germany: +49.211.770967.0Australia: +61.3.9811.8000
-
7/26/2019 Users Guide for SQL Navigator
3/464
Contents
Chapter 1 Quick Tour of SQL Navigator 5
Chapter 2 Whats new in this version? 51
Chapter 3 The SQL Navigator interface 109
-
7/26/2019 Users Guide for SQL Navigator
4/464
ii Welcome to SQL Navigator Version 4 Users Guide
Chapter 4 Navigating the database 167
Chapter 5 Working with SQL statements and scripts 183
Chapter 6 Working with PL/SQL code 237
Chapter 7 Working with HTML and Java 329
Chapter 8 Working with database objects 339
Chapter 9 Tools for analysis and tuning 369
-
7/26/2019 Users Guide for SQL Navigator
5/464
Contents iii
Chapter 10 Version Control and Team Coding 375
Chapter 11 SQL Navigator reports 413
Chapter 12 Customizing SQL Navigator 417
-
7/26/2019 Users Guide for SQL Navigator
6/464
iv Welcome to SQL Navigator Version 4 Users Guide
Chapter 13 Installing server-side objects 441
Chapter 14 The SQL Navigator add-on modules 445
Chapter 15 About Quest Software 449
-
7/26/2019 Users Guide for SQL Navigator
7/464
1Quick Tour of SQL Navigator
For installation instructions, please see the SQLNavigator Getting Startedguide.
In this chapter
Better code, faster. 6The SQL Navigator user interface 6Easy browsing and object navigation 8Fast access to any object 10Instant access to your favorites 12Commands and tools for handling database objects and code 14Visual editors for database objects 26Powerful SQL Editor 28Complete execution environment for stored programs 32Complete and extensible code template libraries 35Team coding and Version Control support 38Web development support 43Reporting tools 47How to find the help you need 48
-
7/26/2019 Users Guide for SQL Navigator
8/464
6 SQL Navigator Users Guide
Better code, faster.
For all the latest product information, includingtips and techniques, visithttp://www.quest.com/sql_navigator.
The SQL Navigator user interface
-
7/26/2019 Users Guide for SQL Navigator
9/464
Chapter 1 Quick Tour of SQL Navigator 7
All Toolbarscan be
floating, docked, orhidden. Toolbar
buttonsbecome activeaccording to itemselected.
Main menu bar.
The DB Navigatorshows the entiredatabase structure as atree with expandablenodes.
The optional Detailspanel shows essentialinformation about theitem selected in thetree.
The Workspacewindow gives youquick access to often-used objects andconnections.
Click on any item in the
Task Barto give itfocus.
The Outputwindowdisplays server outputincluding Oracle errors.
-
7/26/2019 Users Guide for SQL Navigator
10/464
8 SQL Navigator Users Guide
Easy browsing and object navigation
You can set and savefilters to limit theobjects displayed in thetree.
The optional Details panedisplays contents or properties ofthe object selected in the tree.
Commands available onfloating menus and toolbarschange according to the itemsselected in the tree.
The DB Navigator toolbarhelps you navigate andcontrol how schemaobjects are displayed.
Expand nodes (usingmouse clicks or the arrowkeys) to drill down tounderlying objects or data.Double-click an object toopen it for editing.
Drag often-used objects orconnections to yourWorkspace for fast access.
-
7/26/2019 Users Guide for SQL Navigator
11/464
Chapter 1 Quick Tour of SQL Navigator 9
Visualization of schema
Supports most object types
Supports Oracle 8 partitioned tables and indexes
Drill-down on types
Selective viewing
Saved views
Quick table browsing
Create SQL in browser
-
7/26/2019 Users Guide for SQL Navigator
12/464
10 SQL Navigator Users Guide
Fast access to any objectQuickly find objects in any schema
Find objects from stored programs or scripts
Quick Describe
-
7/26/2019 Users Guide for SQL Navigator
13/464
Chapter 1 Quick Tour of SQL Navigator 11
Oracle Data Dictionary views
Search filters
-
7/26/2019 Users Guide for SQL Navigator
14/464
12 SQL Navigator Users Guide
Sorted results
Optional detail view
Double-click anywhere to edit
Locate in schema
Batch selection and update
Instant access to your favorites
List view and Detail view
-
7/26/2019 Users Guide for SQL Navigator
15/464
Chapter 1 Quick Tour of SQL Navigator 13
-
7/26/2019 Users Guide for SQL Navigator
16/464
14 SQL Navigator Users Guide
Managing the Workspace window
The number in brackets after the Workspacename tells you how many items are in the workspace.
To limit the types of objectsshown in the Workspacewindow, click the Filterbutton.
Double-click an object orconnection to open it.
Commands and tools for handling database
objects and code
-
7/26/2019 Users Guide for SQL Navigator
17/464
Chapter 1 Quick Tour of SQL Navigator 15
Default settings for SQL Navigator menus
File menu
-
7/26/2019 Users Guide for SQL Navigator
18/464
16 SQL Navigator Users Guide
Edit menu
-
7/26/2019 Users Guide for SQL Navigator
19/464
Chapter 1 Quick Tour of SQL Navigator 17
Search menu
View menu
-
7/26/2019 Users Guide for SQL Navigator
20/464
18 SQL Navigator Users Guide
Session menu
-
7/26/2019 Users Guide for SQL Navigator
21/464
Chapter 1 Quick Tour of SQL Navigator 19
Object menu
-
7/26/2019 Users Guide for SQL Navigator
22/464
20 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
23/464
Chapter 1 Quick Tour of SQL Navigator 21
Debug menu
-
7/26/2019 Users Guide for SQL Navigator
24/464
22 SQL Navigator Users Guide
Tools menu
-
7/26/2019 Users Guide for SQL Navigator
25/464
Chapter 1 Quick Tour of SQL Navigator 23
Team Coding menu
Windows menu
-
7/26/2019 Users Guide for SQL Navigator
26/464
24 SQL Navigator Users Guide
Help menu
Menu synchronization
-
7/26/2019 Users Guide for SQL Navigator
27/464
Chapter 1 Quick Tour of SQL Navigator 25
Toolbars
Toolbar Purpose
-
7/26/2019 Users Guide for SQL Navigator
28/464
26 SQL Navigator Users Guide
Visual editors for database objects
Opening an object editor from the View menu
-
7/26/2019 Users Guide for SQL Navigator
29/464
Chapter 1 Quick Tour of SQL Navigator 27
Opening an object editor from the DB Navigator tree
-
7/26/2019 Users Guide for SQL Navigator
30/464
28 SQL Navigator Users Guide
Powerful SQL Editor
The SQL window and the results display
Updateable Querybutton
The SQL editing window
contains the SQLstatement(s) to be editedand executed.
It includes an ExecutionStatus pane.
When you execute aSELECT statement, the
Results pane displays therows returned in the form ofa dynamic grid with optionsfor viewing, sorting, andnavigating.
If you want to edit the data,use the Updateable Queryoption in the SQL Editortoolbar when executing.
-
7/26/2019 Users Guide for SQL Navigator
31/464
Chapter 1 Quick Tour of SQL Navigator 29
Code markers
The Spool Output window
-
7/26/2019 Users Guide for SQL Navigator
32/464
-
7/26/2019 Users Guide for SQL Navigator
33/464
-
7/26/2019 Users Guide for SQL Navigator
34/464
-
7/26/2019 Users Guide for SQL Navigator
35/464
Chapter 1 Quick Tour of SQL Navigator 33
-
7/26/2019 Users Guide for SQL Navigator
36/464
-
7/26/2019 Users Guide for SQL Navigator
37/464
Chapter 1 Quick Tour of SQL Navigator 35
Complete and extensible code template libraries
Code Assistant window
-
7/26/2019 Users Guide for SQL Navigator
38/464
-
7/26/2019 Users Guide for SQL Navigator
39/464
Chapter 1 Quick Tour of SQL Navigator 37
Debugger commands
-
7/26/2019 Users Guide for SQL Navigator
40/464
38 SQL Navigator Users Guide
Team coding and Version Control support
Team Coding menu and toolbar
-
7/26/2019 Users Guide for SQL Navigator
41/464
Chapter 1 Quick Tour of SQL Navigator 39
Viewing the status of objects under Team Coding control
Viewing object details in the Team Coding Viewer
Reviewing the Version Control archives
-
7/26/2019 Users Guide for SQL Navigator
42/464
-
7/26/2019 Users Guide for SQL Navigator
43/464
-
7/26/2019 Users Guide for SQL Navigator
44/464
-
7/26/2019 Users Guide for SQL Navigator
45/464
-
7/26/2019 Users Guide for SQL Navigator
46/464
44 SQL Navigator Users Guide
Previewing HTML output in SQL Navigator
-
7/26/2019 Users Guide for SQL Navigator
47/464
-
7/26/2019 Users Guide for SQL Navigator
48/464
-
7/26/2019 Users Guide for SQL Navigator
49/464
-
7/26/2019 Users Guide for SQL Navigator
50/464
-
7/26/2019 Users Guide for SQL Navigator
51/464
Chapter 1 Quick Tour of SQL Navigator 49
Still cant find it?
For all the latest product information, including
tips and techniques, visit
www.quest.com/sql_navigator.
-
7/26/2019 Users Guide for SQL Navigator
52/464
-
7/26/2019 Users Guide for SQL Navigator
53/464
2Whats new in this version?
In this chapter
Whats new in SQL Navigator 4? 52Getting access to new features 52Interface Enhancements 53Editing Enhancements 72Debugger enhancements 89New and improved development tools 94Improved Team Coding facilities 104General and miscellaneous enhancements 105
-
7/26/2019 Users Guide for SQL Navigator
54/464
52 SQL Navigator Users Guide
Whats new in SQL Navigator 4?
To browse descriptions of new features
Getting access to new features
To reset toolbars to the default settings
1
2
3
4
-
7/26/2019 Users Guide for SQL Navigator
55/464
Chapter 2 Whats new in this version? 53
To display or hide individual toolbars1
2
3
To add or remove individual commands
1
2
3
4
Interface Enhancements
Interface Enhancements
-
7/26/2019 Users Guide for SQL Navigator
56/464
-
7/26/2019 Users Guide for SQL Navigator
57/464
Chapter 2 Whats new in this version? 55
Toolbars
-
7/26/2019 Users Guide for SQL Navigator
58/464
-
7/26/2019 Users Guide for SQL Navigator
59/464
Chapter 2 Whats new in this version? 57
This menu... Has commands for...
Main window toolbars
Toolbar Purpose
Object menu and toolbar
-
7/26/2019 Users Guide for SQL Navigator
60/464
-
7/26/2019 Users Guide for SQL Navigator
61/464
-
7/26/2019 Users Guide for SQL Navigator
62/464
-
7/26/2019 Users Guide for SQL Navigator
63/464
-
7/26/2019 Users Guide for SQL Navigator
64/464
62 SQL Navigator Users Guide
Invoking the Properties display from the DB Navigator shortcutmenu
-
7/26/2019 Users Guide for SQL Navigator
65/464
-
7/26/2019 Users Guide for SQL Navigator
66/464
-
7/26/2019 Users Guide for SQL Navigator
67/464
Chapter 2 Whats new in this version? 65
Automatic Source Preview
Previewing an objects source code from the DB Navigator
-
7/26/2019 Users Guide for SQL Navigator
68/464
66 SQL Navigator Users Guide
To preview the source code of text objects1
2
3
Easier switching between sessions
Choosing from the list of current sessions
-
7/26/2019 Users Guide for SQL Navigator
69/464
Chapter 2 Whats new in this version? 67
Speedy selection of database objects
Click Open DB Object
-
7/26/2019 Users Guide for SQL Navigator
70/464
68 SQL Navigator Users Guide
to open the Select DB Object dialog
-
7/26/2019 Users Guide for SQL Navigator
71/464
-
7/26/2019 Users Guide for SQL Navigator
72/464
-
7/26/2019 Users Guide for SQL Navigator
73/464
-
7/26/2019 Users Guide for SQL Navigator
74/464
-
7/26/2019 Users Guide for SQL Navigator
75/464
Chapter 2 Whats new in this version? 73
Improved PL/SQL Editor for stored programs withpowerful new Code Explorer
-
7/26/2019 Users Guide for SQL Navigator
76/464
74 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
77/464
-
7/26/2019 Users Guide for SQL Navigator
78/464
-
7/26/2019 Users Guide for SQL Navigator
79/464
Chapter 2 Whats new in this version? 77
Hyperlinking in the Stored Program editor
Pointing to the variable while pressing Ctrl moves the cursor tothe declaration
-
7/26/2019 Users Guide for SQL Navigator
80/464
78 SQL Navigator Users Guide
Pointing to the object name while pressing Ctrl opens theAutoDescribe window
-
7/26/2019 Users Guide for SQL Navigator
81/464
Chapter 2 Whats new in this version? 79
Easy switching between specification and body
-
7/26/2019 Users Guide for SQL Navigator
82/464
80 SQL Navigator Users Guide
Improved syntax highlighting
Integrated PL/SQL Profiler (Oracle 8.1.5+)
-
7/26/2019 Users Guide for SQL Navigator
83/464
-
7/26/2019 Users Guide for SQL Navigator
84/464
-
7/26/2019 Users Guide for SQL Navigator
85/464
-
7/26/2019 Users Guide for SQL Navigator
86/464
-
7/26/2019 Users Guide for SQL Navigator
87/464
-
7/26/2019 Users Guide for SQL Navigator
88/464
86 SQL Navigator Users Guide
The Quick Browse and Edit Data commands open the SQL Editor
-
7/26/2019 Users Guide for SQL Navigator
89/464
Chapter 2 Whats new in this version? 87
Source Code Search enhancements
Extract DDL enhancements
-
7/26/2019 Users Guide for SQL Navigator
90/464
88 SQL Navigator Users Guide
Shortcut menu options for code search results
-
7/26/2019 Users Guide for SQL Navigator
91/464
Chapter 2 Whats new in this version? 89
Debugger enhancements
Debugger enhancements
Context-sensitive tooltip description for identifiers
Multi-paged Output window
-
7/26/2019 Users Guide for SQL Navigator
92/464
90 SQL Navigator Users Guide
Execution code generation enhancements
-
7/26/2019 Users Guide for SQL Navigator
93/464
-
7/26/2019 Users Guide for SQL Navigator
94/464
-
7/26/2019 Users Guide for SQL Navigator
95/464
Chapter 2 Whats new in this version? 93
Step 3set options for variables, parameters, andCOMMIT/ROLLBACK
-
7/26/2019 Users Guide for SQL Navigator
96/464
94 SQL Navigator Users Guide
Step 4(optional) monitor profiling results
New and improved development tools
Formatter Plus and Knowledge Xpert
-
7/26/2019 Users Guide for SQL Navigator
97/464
Chapter 2 Whats new in this version? 95
Describe tool enhancements
Selecting AutoDescribe for a table
-
7/26/2019 Users Guide for SQL Navigator
98/464
96 SQL Navigator Users Guide
The AutoDescribe window
-
7/26/2019 Users Guide for SQL Navigator
99/464
Chapter 2 Whats new in this version? 97
Easier viewing of data in database objects
SQL Navigator does not support working with
LOB or Object table columns when using anOracle 7 client connected to Oracle 8 database.For full functionality, use an Oracle 8 client to
connect to an Oracle 8 database.
Support for LOBs (large objects)
Type View Edit
-
7/26/2019 Users Guide for SQL Navigator
100/464
98 SQL Navigator Users Guide
Object Data Viewer
Viewing a binary object in the BLOB viewer
-
7/26/2019 Users Guide for SQL Navigator
101/464
Chapter 2 Whats new in this version? 99
Viewing character data in the CLOB viewer
-
7/26/2019 Users Guide for SQL Navigator
102/464
100 SQL Navigator Users Guide
Support for Oracle 8 partitioned tables and indexes
-
7/26/2019 Users Guide for SQL Navigator
103/464
Chapter 2 Whats new in this version? 101
New and enhanced Visual Object Editors
New edit functions
User can set default schema for object editors
-
7/26/2019 Users Guide for SQL Navigator
104/464
102 SQL Navigator Users Guide
Query Builder enhancements
Code Assistant enhancements
Launch the Code Assistant from the View menu
-
7/26/2019 Users Guide for SQL Navigator
105/464
Chapter 2 Whats new in this version? 103
The Code Assistant
-
7/26/2019 Users Guide for SQL Navigator
106/464
-
7/26/2019 Users Guide for SQL Navigator
107/464
-
7/26/2019 Users Guide for SQL Navigator
108/464
106 SQL Navigator Users Guide
More convenient Logon routine
Improved date/time representation and handling
More stable, easier to maintain
-
7/26/2019 Users Guide for SQL Navigator
109/464
Chapter 2 Whats new in this version? 107
Superceded functionality
-
7/26/2019 Users Guide for SQL Navigator
110/464
-
7/26/2019 Users Guide for SQL Navigator
111/464
3The SQL Navigator interface
In this chapter
Overview of the SQL Navigator interface 110Menus, Toolbars, & Commands 122Keyboard shortcuts 135Code editors overview 142Workspaces: A smarter way of working 146Connecting to the Oracle database 155Viewing server output 161The Oracle Job Manager 162
-
7/26/2019 Users Guide for SQL Navigator
112/464
-
7/26/2019 Users Guide for SQL Navigator
113/464
Chapter 3 The SQL Navigator interface 111
All Toolbarscan be
floating, docked, orhidden. Toolbar
buttonsbecome activeaccording to itemselected.
Main menu bar.
The DB Navigatorshows the entiredatabase structure as atree with expandablenodes.
The optional Detailspanel shows essentialinformation about theitem selected in thetree.
The Workspacewindow gives youquick access to often-used objects andconnections.
Click on any item in the
Task Barto give itfocus.
The Outputwindowdisplays server outputincluding Oracle errors.
-
7/26/2019 Users Guide for SQL Navigator
114/464
112 SQL Navigator Users Guide
The Task Bar
To enable the SQL Navigator Task Bar
Managing windows
-
7/26/2019 Users Guide for SQL Navigator
115/464
Chapter 3 The SQL Navigator interface 113
Saving Window Layouts
To save and swap window layouts
1
2
3
Accessing functions and tools
Navigating the database with DB Navigator
-
7/26/2019 Users Guide for SQL Navigator
116/464
114 SQL Navigator Users Guide
Tree view and detail view
To show or hide the DB Navigator details pane
Display and selection options
Data Dictionary views
-
7/26/2019 Users Guide for SQL Navigator
117/464
Chapter 3 The SQL Navigator interface 115
-
7/26/2019 Users Guide for SQL Navigator
118/464
116 SQL Navigator Users Guide
Finding objects quickly
Displaying a schema object and its properties
To locate an open or selected object in the schema
-
7/26/2019 Users Guide for SQL Navigator
119/464
Chapter 3 The SQL Navigator interface 117
You can hide the right pane to save screen spaceor increase the speed of the display.
Click (the Show/Hide Detailsbutton) on theDB Navigator toolbar
Or
Right-click in the DB Navigator window and
choose View Show/Hide Detailsfrom theshortcut menu.
Managing database objects
-
7/26/2019 Users Guide for SQL Navigator
120/464
118 SQL Navigator Users Guide
Opening a visual object editor
-
7/26/2019 Users Guide for SQL Navigator
121/464
Chapter 3 The SQL Navigator interface 119
Opening objects
You can use the SQL wildcard character % as part
of your search for object names. The wildcard by
itself will return all object names meeting thecriteria.
To open a database object in a visual editor
-
7/26/2019 Users Guide for SQL Navigator
122/464
120 SQL Navigator Users Guide
To create a database object
Performing actions on a selected schema object
-
7/26/2019 Users Guide for SQL Navigator
123/464
Chapter 3 The SQL Navigator interface 121
Oracle Data Dictionary views
Required privileges
How SQL Navigator handles the views
Using DBA dictionary viewsmay affectperformance for some Oracle instances,
depending on the number of users and objects, aswell as other environmental factors.
-
7/26/2019 Users Guide for SQL Navigator
124/464
122 SQL Navigator Users Guide
Menus, Toolbars, & Commands
Menus
Main menu bar
This menu Has commands for
-
7/26/2019 Users Guide for SQL Navigator
125/464
Chapter 3 The SQL Navigator interface 123
Menu synchronization
SQL Navigator command list
-
7/26/2019 Users Guide for SQL Navigator
126/464
124 SQL Navigator Users Guide
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
127/464
Chapter 3 The SQL Navigator interface 125
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
128/464
126 SQL Navigator Users Guide
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
129/464
Chapter 3 The SQL Navigator interface 127
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
130/464
128 SQL Navigator Users Guide
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
131/464
Chapter 3 The SQL Navigator interface 129
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
132/464
130 SQL Navigator Users Guide
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
133/464
Chapter 3 The SQL Navigator interface 131
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
134/464
132 SQL Navigator Users Guide
Command Menu or Toolbar
-
7/26/2019 Users Guide for SQL Navigator
135/464
Chapter 3 The SQL Navigator interface 133
Toolbars
Toolbars
Toolbar Purpose
-
7/26/2019 Users Guide for SQL Navigator
136/464
134 SQL Navigator Users Guide
The Team Coding Toolbar
The Session toolbar
The Object Toolbar
The Functions Toolbar
The Edit Toolbar
The Debug Toolbar
-
7/26/2019 Users Guide for SQL Navigator
137/464
Chapter 3 The SQL Navigator interface 135
Keyboard shortcuts
-
7/26/2019 Users Guide for SQL Navigator
138/464
136 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
139/464
Chapter 3 The SQL Navigator interface 137
-
7/26/2019 Users Guide for SQL Navigator
140/464
138 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
141/464
Chapter 3 The SQL Navigator interface 139
Programming shortcuts
To program shortcut keys
1
2
3
Default settings
-
7/26/2019 Users Guide for SQL Navigator
142/464
140 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
143/464
Chapter 3 The SQL Navigator interface 141
Debugging shortcuts
-
7/26/2019 Users Guide for SQL Navigator
144/464
142 SQL Navigator Users Guide
Code editors overview
Code editors
To create or edit Use this editor
SQL Editor overview
-
7/26/2019 Users Guide for SQL Navigator
145/464
Chapter 3 The SQL Navigator interface 143
The SQL window and the results display
-
7/26/2019 Users Guide for SQL Navigator
146/464
144 SQL Navigator Users Guide
Code markers
The Spool Output window
-
7/26/2019 Users Guide for SQL Navigator
147/464
Chapter 3 The SQL Navigator interface 145
The Stored Program Editor
-
7/26/2019 Users Guide for SQL Navigator
148/464
146 SQL Navigator Users Guide
Workspaces: A smarter way of working
You might want to try making your work easier by
creating specialized Workspaces for
All objects and files related to a project
All database connections
Built-in utility packs, procedures, or functions(such as DBMS_OUTPUT/PIPE/ALERT packages)
Home-grown utility packs
-
7/26/2019 Users Guide for SQL Navigator
149/464
Chapter 3 The SQL Navigator interface 147
Caution If you save the password when you
create the connection, nopassword will berequired to open a connection from the
workspace.
To create a workspace
-
7/26/2019 Users Guide for SQL Navigator
150/464
148 SQL Navigator Users Guide
The workspace window
-
7/26/2019 Users Guide for SQL Navigator
151/464
Chapter 3 The SQL Navigator interface 149
Managing the Workspace window
Managing workspaces
Managing workspaces
To add an object or file to the current workspace
You can set a preference to automatically add
objects to a current workspace when a specifiedevent occurs (such as opening or editing anobject).
-
7/26/2019 Users Guide for SQL Navigator
152/464
150 SQL Navigator Users Guide
Saving connection shortcuts in your Workspace
To connect to a database from the workspace
To open a workspace object for editing
-
7/26/2019 Users Guide for SQL Navigator
153/464
Chapter 3 The SQL Navigator interface 151
To connect to a database and open a DB Navigator window
1
2
Caution If you save the password when you
create the connection, nopassword will be
required to open the connection from theworkspace.
To open a workspace
1
2
3
-
7/26/2019 Users Guide for SQL Navigator
154/464
152 SQL Navigator Users Guide
To filter the list of objects in a workspace
1
2
To open a workspace object or file
1
2
3
To remove an object or file from a workspace
Invoking the Describe command for a workspace object
-
7/26/2019 Users Guide for SQL Navigator
155/464
Chapter 3 The SQL Navigator interface 153
To enable the AutoDescribe feature
1 2 3
To invoke the Describe command
1 2
3
To view or update objects in a workspace
Context-sensitive commands in workspaces
-
7/26/2019 Users Guide for SQL Navigator
156/464
154 SQL Navigator Users Guide
To do this With this object Use thiscommand
-
7/26/2019 Users Guide for SQL Navigator
157/464
Chapter 3 The SQL Navigator interface 155
Connecting to the Oracle database
Connecting using Net8
Connecting Using Connect Strings
Examples of Connect Strings for SQL*Net 1
t:Seattle:PRODN
x:server1
d:boston:devp
Example of a Connect String for SQL*Net 2
Prodn1
SQL*Net 2.x connect strings (also called service
names) are defined in the file tnsnames.ora,usually located in the c:\orawin95\network\admindirectory for Windows 95 and in the
c:\orant\network\admin directory for Windows NT.
To modify these connect strings use only theOracle SQL*Net Easy Configuration Utility.
-
7/26/2019 Users Guide for SQL Navigator
158/464
156 SQL Navigator Users Guide
There are many communication protocols andconfigurations available for SQL*Net. For moreinformation, refer to any of the following
resources:
SQL*Net Administrators Guide
SQL*Net Users Guide
Your companys DBA or system administrator
Connecting using command line parameters
Connecting to Personal Oracle
Connecting to a database from the SQL Editor
To connect to a database via the SQL Editor
Connect name/password@database
-
7/26/2019 Users Guide for SQL Navigator
159/464
Chapter 3 The SQL Navigator interface 157
To disconnect from a database via the SQL Editor
Disconnect name/password@database
To close a connection
To activate another session in another window
Oracle Logon
The Logon dialog on startup is controlled by a Preferencesoption. See page 422, Show Logon Dialog at startup
-
7/26/2019 Users Guide for SQL Navigator
160/464
158 SQL Navigator Users Guide
Automatically saving passwords
Creating a session
Switching between sessions
-
7/26/2019 Users Guide for SQL Navigator
161/464
Chapter 3 The SQL Navigator interface 159
Choosing from the list of current sessions
To switch sessions or create a new session
Use the drop-downlist on the Session
Toolbar to switch
sessions.
Alternatively, youcan click the New
Session icon to
open a new one.
Fast access to connections stored in your Workspace
-
7/26/2019 Users Guide for SQL Navigator
162/464
160 SQL Navigator Users Guide
The workspace window can includeconnection shortcuts
Troubleshooting Connections to Oracle
Message Solution
-
7/26/2019 Users Guide for SQL Navigator
163/464
Chapter 3 The SQL Navigator interface 161
Viewing server output
Viewing server output
Interpreting the output display
Color Data type
To display the Output window
-
7/26/2019 Users Guide for SQL Navigator
164/464
162 SQL Navigator Users Guide
To change size of the buffer for server output
1
2
3
To print Output window contents
To copy and paste selected text from the Output window
1
2
The Oracle Job Manager
Managing jobs
-
7/26/2019 Users Guide for SQL Navigator
165/464
Chapter 3 The SQL Navigator interface 163
To view job properties
1
2
Oracle Job Manager job properties
Control Tab
Field Description
Advanced tab
Field Description
-
7/26/2019 Users Guide for SQL Navigator
166/464
164 SQL Navigator Users Guide
To delete a job from the queue
1
2
3
To disable a job
You can disable only jobs that you own. If you try
to mark a job you do not own, the Job Managerdisplays a message stating that the job is not in
the job queue.
1
2
3
4
To edit or create a job
1
2
3
-
7/26/2019 Users Guide for SQL Navigator
167/464
Chapter 3 The SQL Navigator interface 165
1
2
3
4
To run a job
1
2
-
7/26/2019 Users Guide for SQL Navigator
168/464
-
7/26/2019 Users Guide for SQL Navigator
169/464
4Navigating the database
In this chapter
Navigating the database 168The DB Navigator window 168DB Navigator commands 170Working with objects in the DB Navigator 172DB Navigator drag-and-drop tips 180
-
7/26/2019 Users Guide for SQL Navigator
170/464
168 SQL Navigator Users Guide
Navigating the database
The DB Navigator window
A hierarchical view of the database
-
7/26/2019 Users Guide for SQL Navigator
171/464
Chapter 4 Navigating the database 169
To show or hide the DB Navigator details pane
-
7/26/2019 Users Guide for SQL Navigator
172/464
170 SQL Navigator Users Guide
Interpreting the DB Navigator display
This symbol Indicates that
DB Navigator commands
DB Navigator toolbar commands
Using the (Forward) and (Back) buttons
-
7/26/2019 Users Guide for SQL Navigator
173/464
Chapter 4 Navigating the database 171
To show or hide details about the selected DB Navigator node
To move around in the Navigator window
To expand a node in the DB Navigator
To collapse a node in the DB Navigator
To expand the selected DB Navigator node and all itsdescendants
To refresh the entire DB Navigator tree from the database
-
7/26/2019 Users Guide for SQL Navigator
174/464
172 SQL Navigator Users Guide
Working with objects in the DB Navigator
Finding and opening objects in the DB Navigator
To display a dynamic list of all objects in a schema
1
2
3
4
Opening an object from the DB Navigator
Locating an object in the schema from an editor
To locate an open or selected object in the schema
-
7/26/2019 Users Guide for SQL Navigator
175/464
Chapter 4 Navigating the database 173
You can hide the right pane to save screen spaceor increase the speed of the display.
Click (the Show/Hide Detailsbutton)on the DB Navigator toolbar
Or
Right-click in the DB Navigator window and
choose View Show/Hide Detailsfrom theshortcut menu.
Using filters to customize the display of objects
Oracle data dictionary views
Quickly finding objects in any schema
To display a dynamic list of all objects in a schema
1
2
3
4
-
7/26/2019 Users Guide for SQL Navigator
176/464
174 SQL Navigator Users Guide
To open a found object for editing
To select and edit multiple objects
Viewing the contents of a DB Navigator tree node
To open an object from the DB Navigator window
Finding objects by search argument
-
7/26/2019 Users Guide for SQL Navigator
177/464
-
7/26/2019 Users Guide for SQL Navigator
178/464
176 SQL Navigator Users Guide
Displaying an objects place in the schema
To locate an object in the schema
To apply DB Navigator filters to restrict the object typesdisplayed for a session
LIKE ABC%
To define filter properties
1
2
3
-
7/26/2019 Users Guide for SQL Navigator
179/464
Chapter 4 Navigating the database 177
4
5
6
To display the shortcut menu for a selected object
To perform an action on a database object in the DB Navigator
To view or hide details about the selected DB Navigator node
To create a database object from the DB Navigator
To edit a database object from the DB Navigator
To drop a database object from the DB Navigator
-
7/26/2019 Users Guide for SQL Navigator
180/464
178 SQL Navigator Users Guide
To rename a database object from the DB Navigator
To compile an object from the DB Navigator
In the DB Navigator
Browsing or editing table data from the DB Navigator
To browse or edit table data from the DB Navigator
1
2
To Do this
-
7/26/2019 Users Guide for SQL Navigator
181/464
Chapter 4 Navigating the database 179
To build a query from a selected table1
2
3
To extract DDL in the DB Navigator and display it in the SQL
Editor
1
2
To invoke the DESCRIBE command for an object in the DBNavigator
-
7/26/2019 Users Guide for SQL Navigator
182/464
180 SQL Navigator Users Guide
To enable the AutoDescribe feature1 2 3
To invoke the Describe command
1 2
3
To view or edit database object definition in the DB Navigator
To execute a stored program from the DB Navigator
DB Navigator drag-and-drop tips
To drag database object names from the DB navigator into aneditor
To add a code location shortcut to a workspace
-
7/26/2019 Users Guide for SQL Navigator
183/464
Chapter 4 Navigating the database 181
To add an external file to the current workspace
To add an object to a workspace
To add an object to the Query Builder work area
To copy an object from one schema to another
To open an external file in SQL Editor
To open an object in an editor
-
7/26/2019 Users Guide for SQL Navigator
184/464
-
7/26/2019 Users Guide for SQL Navigator
185/464
5Working with SQL statements andscripts
In this chapter
Writing and editing SQL code 184Fast query building with the Query Builder 212Executing SQL and working with results 226The Spool window 230Viewing results in the Result window 232
-
7/26/2019 Users Guide for SQL Navigator
186/464
184 SQL Navigator Users Guide
Writing and editing SQL code
The SQL Editor
To open the SQL Editor
-
7/26/2019 Users Guide for SQL Navigator
187/464
Chapter 5 Working with SQL statements and scripts 185
The SQL window
To display the SQL editing window
SQL Editor toolbar commands
Command Description
-
7/26/2019 Users Guide for SQL Navigator
188/464
186 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
189/464
Chapter 5 Working with SQL statements and scripts 187
SQL Editor shortcut menu commands
SQL Window
Command Description
-
7/26/2019 Users Guide for SQL Navigator
190/464
188 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
191/464
Chapter 5 Working with SQL statements and scripts 189
The Output window
To display the Output window
Interpreting the output display
Color Data type
To change size of the buffer for server output
1
2
3
To copy and paste selected text from the Output window
1
2
3
-
7/26/2019 Users Guide for SQL Navigator
192/464
190 SQL Navigator Users Guide
To clear the Output window
To print the contents of the Output window
Editing SQL code
-
7/26/2019 Users Guide for SQL Navigator
193/464
Chapter 5 Working with SQL statements and scripts 191
Edit menu and toolbar quick-reference
TheEdittoolbar is dockable, so you can place it
where it is most convenient. To see a hint
describing the function of any button on the
toolbar, position the mouse pointer over it.
Point-and-click column names from any object
To insert a column name
1
2
3
4
-
7/26/2019 Users Guide for SQL Navigator
194/464
192 SQL Navigator Users Guide
The Edit menu The Edit toolbar
-
7/26/2019 Users Guide for SQL Navigator
195/464
Chapter 5 Working with SQL statements and scripts 193
Inserting code from another file
To insert selected source code from another file
1
2
3
To insert the entire text from another file from another file
1
2
Inserting ready-made code via shortcut keys
To insert code from a template
1
2
J
J
-
7/26/2019 Users Guide for SQL Navigator
196/464
194 SQL Navigator Users Guide
Code templates and their assigned shortcuts
Code Description Shortcut Key
SQL*Plus command support
-
7/26/2019 Users Guide for SQL Navigator
197/464
Chapter 5 Working with SQL statements and scripts 195
Validating syntax
Automatic indentation
Begin/End markers for loops and blocks
-
7/26/2019 Users Guide for SQL Navigator
198/464
196 SQL Navigator Users Guide
Using Bookmarks in the SQL Editor
To set a bookmark using a shortcut menu
1
2
To set a bookmark using a keyboard shortcut
To list bookmarks
-
7/26/2019 Users Guide for SQL Navigator
199/464
Chapter 5 Working with SQL statements and scripts 197
To go to a bookmark using a shortcut menu1
2
3
To go to a bookmark using a keyboard shortcut
Previewing an objects source code
To preview the source
1
2
Formatting source code
To format source code
1
2
-
7/26/2019 Users Guide for SQL Navigator
200/464
198 SQL Navigator Users Guide
Dragging names of database objects into code
To drag-and-drop names of database objects
Using substitution variables for flexible SQL statements
Toggle onthe Scan Defines feature whenusing variables or text that contain the
characters &, &&, or = :[bind variable].
Otherwise, the statement containing thevariables will generate an error.
Specifying substitution variables with the & symbol
& &EMPNUM
SELECT *
FROM EMP
WHERE EMPNUM = &EMPNUM;
-
7/26/2019 Users Guide for SQL Navigator
201/464
Chapter 5 Working with SQL statements and scripts 199
SELECT &COL1, &COL2
FROM &TAB;
CREATE USER &&UNAME IDENTIFIED BY &PASS;
GRANT ALL ON EMP TO &&UNAME;
Specifying substitution variables with the && symbol
&& DEFINE &&
&& UNDEFINE
Defining and undefining numeric and character variables
DEFINE UNDEFINE
To define numeric and character variables
DEFINE
-
7/26/2019 Users Guide for SQL Navigator
202/464
200 SQL Navigator Users Guide
DEFINE EMP_NAME=SCOTT
DEFINE EMP_NUM=4467
To undefine numeric and character variables
UNDEFINE
UNDEFINE EMP_NAME
Using Bind variables
VARIABLE s_table_name varchar2(30)
BEGIN
:s_table_name := EMPLOYEE;
END;
/
Debugging a variable in the SQL Editor
To generate a debug statement
1
2
-
7/26/2019 Users Guide for SQL Navigator
203/464
Chapter 5 Working with SQL statements and scripts 201
Integrated impact analysis and quality assurance
Entering multiple SQL statements
To insert a saved text file into the SQL Editor
1
2
3
Entering PL/SQL blocks
-
7/26/2019 Users Guide for SQL Navigator
204/464
202 SQL Navigator Users Guide
BEGIN
Test_procedure;
END;
Copying selected text
To copy to the clipboard
To paste from the clipboard
Creating a DBMS_OUTPUT.PUT_LINE statement
To create a DBMS_OUTPUT.PUT_LINE statement for a variable
1
2
-
7/26/2019 Users Guide for SQL Navigator
205/464
Chapter 5 Working with SQL statements and scripts 203
Jumping to a specified line
To go to a line number
Indenting and unindenting
To increase or decrease the indent of selected text
Inserting a CRUD matrix
Inserting ready-made code from templates
To insert prepared code into the editor
1
2 J
3
4
-
7/26/2019 Users Guide for SQL Navigator
206/464
204 SQL Navigator Users Guide
Recalling previously executed SQL
To recall previously executed SQL
1
2
3
Using bookmarks
To set a bookmark
To go to a bookmark
-
7/26/2019 Users Guide for SQL Navigator
207/464
Chapter 5 Working with SQL statements and scripts 205
Undo or Redo your editing operations
To undo or redo an editing operation
Tuning with the Explain Plan tool
Analyzing queries with Explain Plan
The Explain Plan tool can be used to analyze the
execution of single SQL statements only.
-
7/26/2019 Users Guide for SQL Navigator
208/464
206 SQL Navigator Users Guide
To change default preferences for the Explain Plan tool1
2
To execute an Explain Plan for a SQL Statement
1
2
3
4
5
6
7
8
9
10
11
Viewing the Explain Plan tree
Printing the Explain Plan tree
-
7/26/2019 Users Guide for SQL Navigator
209/464
Chapter 5 Working with SQL statements and scripts 207
When an Explain Plan tree printout exceeds one
page, the headings (such as the SQL Text and
statement ID lines) are not repeated. This makes iteasy for you to tilemultiple pages together to
display the explain plan tree as a single diagram
Viewing an Operation Description
To view the Operation Description
Browsing saved plans
To use the saved plans browser
1
2
3
4
5
-
7/26/2019 Users Guide for SQL Navigator
210/464
208 SQL Navigator Users Guide
Tuning a SQL script
Xpert Tuning
Xpert Tuning can be used to analyze theexecution of SQL scripts containing more thanone statement.
1
2
3
4
-
7/26/2019 Users Guide for SQL Navigator
211/464
Chapter 5 Working with SQL statements and scripts 209
To set editor preferences1
2
3
Working with code templates and shortcuts
To open the Code Shortcuts and Templates dialog
To insert code from a template
1
2
J
J
To create a new template
1
2
3
4
5
6
7
-
7/26/2019 Users Guide for SQL Navigator
212/464
210 SQL Navigator Users Guide
To edit an existing template1
2
3
You cannot change a template name. Instead, you
can delete an existing template and createanother like it with a different name.
To delete a template
1
2
3
You cannot delete all the templates. There must
be at least one template remaining in the Code
Templates and Shortcutsdialog.
Customizing SQL Editor toolbars
Hiding or showing toolbars
-
7/26/2019 Users Guide for SQL Navigator
213/464
Chapter 5 Working with SQL statements and scripts 211
To quick-select toolbars1
2
To customize toolbars
1
2
3
4
Adding and removing toolbar buttons
To hide or show a button
1
2
3
To assign a button
1
2
3
4
5
-
7/26/2019 Users Guide for SQL Navigator
214/464
212 SQL Navigator Users Guide
To remove a button1
2
3
4
Customizing toolbar button appearance
To customize button appearance
1
2
3
4
5
Fast query building with the Query Builder
SELECT UPDATEINSERT DELETE
-
7/26/2019 Users Guide for SQL Navigator
215/464
Chapter 5 Working with SQL statements and scripts 213
The Query Builder window
-
7/26/2019 Users Guide for SQL Navigator
216/464
214 SQL Navigator Users Guide
Quickly build complex SQL statements
Sort and group
Save and re-use queries
Execute and Roll-back
Query Builder quick reference
To get started with the Query Builder
1
2
3
-
7/26/2019 Users Guide for SQL Navigator
217/464
Chapter 5 Working with SQL statements and scripts 215
If you want to Then
1.
2.
1.
2.
-
7/26/2019 Users Guide for SQL Navigator
218/464
216 SQL Navigator Users Guide
If you want to Then
To set rules, options or criteria for a query
1
2
3
4
When a square button appears inside the cell, you
can use the spacebar or Ctrl+Enterto open the
column editing window.
-
7/26/2019 Users Guide for SQL Navigator
219/464
Chapter 5 Working with SQL statements and scripts 217
Specifying WHERE clauses
If the column is selected
If the column is not selected
Automatic insertion of column names into a WHERE clause
-
7/26/2019 Users Guide for SQL Navigator
220/464
218 SQL Navigator Users Guide
Operator Meaning Example
Customizing Query Builder
Code catalogs for fast and easy coding
-
7/26/2019 Users Guide for SQL Navigator
221/464
Chapter 5 Working with SQL statements and scripts 219
SQL Navigator provides two tools that assist ininformation sharing among members of adevelopment team. The shared catalog can beused to maintain a repository of code snippets,
while the standards catalog allows SQL and
PL/SQL templates to be stored.
For tips and techniques, seehttp://www.quest.com/sql_navigator
Using code catalogs and the Code Assistant
-
7/26/2019 Users Guide for SQL Navigator
222/464
220 SQL Navigator Users Guide
Code Assistant window
To open the Code Assistant
-
7/26/2019 Users Guide for SQL Navigator
223/464
Chapter 5 Working with SQL statements and scripts 221
To change Code Assistant preferences and display settings
Automatically starting Code Assistant with editors
To set the Autostart Code Assistant preference
1
2
Viewing information about catalog objects
To show or hide the Information pane
-
7/26/2019 Users Guide for SQL Navigator
224/464
222 SQL Navigator Users Guide
Adding, editing or deleting catalog items
To add, edit or delete catalog items
The following constraints apply:
You cannot delete top-level nodes of the tree.
You cannot rename the top-level folders in thetree.
To rename a catalog item
-
7/26/2019 Users Guide for SQL Navigator
225/464
Chapter 5 Working with SQL statements and scripts 223
Use descriptive names for catalog items. Namescan be up to 35 characters long and containuppercase letters, lowercase letters, and any ofthe following characters:
_ - & space< > / , ( ) ..
Saving your SQL statements and code in catalogs
You can use the Code and SQL catalog to build
your own version of the Syntax catalog. Simplyadd your own syntax items to the catalog and use
a consistent prefix to group the items together;for example:
Syn- IF THEN ELSIF
Syn- WHERE clause
Syn- SQL - Correlated subquery
Etc.
Alternatively, you can add new items directly intothe Syntax catalog of the Code Assistant.
-
7/26/2019 Users Guide for SQL Navigator
226/464
224 SQL Navigator Users Guide
Placing Items into the code catalogs
To add to the catalog from the editor window
1
2
Use descriptive names for catalog items. Namescan be up to 35 characters long and contain
uppercase letters, lowercase letters, and any of
the following characters:
_ - & space< > / , ( ) ..
To add to the catalog from the code catalog window
1
2
To move a snippet from the catalog into the editor
1
2
3
4
-
7/26/2019 Users Guide for SQL Navigator
227/464
Chapter 5 Working with SQL statements and scripts 225
Saving and re-using code
Viewing Describe information
-
7/26/2019 Users Guide for SQL Navigator
228/464
226 SQL Navigator Users Guide
Executing SQL and working with results
Executing a SQL script
Displaying results
Error descriptions
Executing SQL statements
-
7/26/2019 Users Guide for SQL Navigator
229/464
Chapter 5 Working with SQL statements and scripts 227
Viewing processing status
To execute the SQL statements displayed in the SQL Editor
To execute an individual SQL statement
SQL Editor Execution Status pane
To display an error description
Changing the contents of the execution status pane
To change the type of information displayed in the execution
status pane
-
7/26/2019 Users Guide for SQL Navigator
230/464
228 SQL Navigator Users Guide
SQL window Status line
Running multiple queries
Running the same script against different databases
The drop-down list on the Session Toolbar
Executing updateable queries
-
7/26/2019 Users Guide for SQL Navigator
231/464
Chapter 5 Working with SQL statements and scripts 229
SELECT
Updateable queries are slow to execute.
Turn off the Updateable Query optionunless you expect to update the data
returned.
To run an updateable query
1
2 SELECT
3
4
5
To save your changes to the database
To undo your changes to the database
-
7/26/2019 Users Guide for SQL Navigator
232/464
230 SQL Navigator Users Guide
If the Commit and Rollback buttons on theSession toolbar appear dimmed, then youprobably have the Immediately Commit Every
DML Statement preference selected. This meansthat your changes to query results are
automatically being saved to the database.
To confirm or change this setting, choosePreferences from the View menu and then open
the Session preferences.
Errors from updateable queries
TOKEN:.(12121,2),
The Spool window
To display the text of the executed statement in theSpool window
-
7/26/2019 Users Guide for SQL Navigator
233/464
Chapter 5 Working with SQL statements and scripts 231
Spool window toolbar buttons
Button Function
Spool window shortcut menu commands
Menu Option Function
To display SQL statements in the Spool window
Retrieving previously executed SQL statements
Spooling results as text
-
7/26/2019 Users Guide for SQL Navigator
234/464
232 SQL Navigator Users Guide
To view results in text form
To view results in text form
To view the text of a memo field
Viewing results in the Result window
Result Display of the SQL Editor
-
7/26/2019 Users Guide for SQL Navigator
235/464
Chapter 5 Working with SQL statements and scripts 233
Working with query results
Editing query results
Exporting query results
To export query results
1
2
Printing query results
-
7/26/2019 Users Guide for SQL Navigator
236/464
234 SQL Navigator Users Guide
To print query results1
2
3
4
Viewing objects in table columns
To display the details of a selected record
To display multiple rows in a data sheet format
To sort the data sheet
To fetch sets of rows
-
7/26/2019 Users Guide for SQL Navigator
237/464
Chapter 5 Working with SQL statements and scripts 235
Copying data from the Result window
To copy and paste selected data
1
2
3
4
Switching between SQL code and results
For this SQL Editor window Use this key
Selecting, inserting and deleting results data
To select the entire data sheet
To insert a new row into the data sheet before the current row
-
7/26/2019 Users Guide for SQL Navigator
238/464
236 SQL Navigator Users Guide
To delete the current row
To jump between a query and its results page
To jump to the associated results tab
-
7/26/2019 Users Guide for SQL Navigator
239/464
6Working with PL/SQL code
In this chapter
Working with PL/SQL: Overview 238Typical PL/SQL editing scenario 240Working with packages 240Tools and commands for editing stored programs 242Database Source Code Search 267Writing and editing stored programs 268Executing stored programs 275Optimizing stored programs: The PL/SQL Profiler 280Debugging PL/SQL 295
-
7/26/2019 Users Guide for SQL Navigator
240/464
238 SQL Navigator Users Guide
Working with PL/SQL: Overview
-
7/26/2019 Users Guide for SQL Navigator
241/464
Chapter 6 Working with PL/SQL code 239
Example
1
2
3
4
5
6
7
-
7/26/2019 Users Guide for SQL Navigator
242/464
240 SQL Navigator Users Guide
Typical PL/SQL editing scenario
Working with packages
-
7/26/2019 Users Guide for SQL Navigator
243/464
Chapter 6 Working with PL/SQL code 241
Sample view of a package in two synchronized panes
-
7/26/2019 Users Guide for SQL Navigator
244/464
242 SQL Navigator Users Guide
Tools and commands for editing stored programs
Commands for are found here
Advanced editing features for stored programs
Smart code completion
-
7/26/2019 Users Guide for SQL Navigator
245/464
Chapter 6 Working with PL/SQL code 243
Dot-lookup
Code Explorer
Customizable syntax highlighting for PL/SQL
Dynamic highlighting of matching pairs of brackets
Dynamic highlighting of the closest encompassing block
One-key switching between implementation and specification ofa packaged procedure
Hyperlinking
Syntax tooltips
-
7/26/2019 Users Guide for SQL Navigator
246/464
244 SQL Navigator Users Guide
Controlling what is displayed in the Stored ProgramEditor
Stored Program Editor toolbar commands
-
7/26/2019 Users Guide for SQL Navigator
247/464
Chapter 6 Working with PL/SQL code 245
Managing stored programs as database objects
Object menu and toolbar commands (stored procedure open)
-
7/26/2019 Users Guide for SQL Navigator
248/464
246 SQL Navigator Users Guide
To Use this command
-
7/26/2019 Users Guide for SQL Navigator
249/464
Chapter 6 Working with PL/SQL code 247
Editing code in stored programs
Edit menu and toolbar commands (stored procedure open)
-
7/26/2019 Users Guide for SQL Navigator
250/464
248 SQL Navigator Users Guide
To Use this command
-
7/26/2019 Users Guide for SQL Navigator
251/464
Chapter 6 Working with PL/SQL code 249
Automated coding assistance
-
7/26/2019 Users Guide for SQL Navigator
252/464
250 SQL Navigator Users Guide
Searching for code or objects in the database
Search menu commands
-
7/26/2019 Users Guide for SQL Navigator
253/464
Chapter 6 Working with PL/SQL code 251
To Use this command
Using other SQL Navigator windows with the StoredProgram Editor
-
7/26/2019 Users Guide for SQL Navigator
254/464
252 SQL Navigator Users Guide
View menu commands
-
7/26/2019 Users Guide for SQL Navigator
255/464
Chapter 6 Working with PL/SQL code 253
To Use this command
-
7/26/2019 Users Guide for SQL Navigator
256/464
254 SQL Navigator Users Guide
Managing your editing session
-
7/26/2019 Users Guide for SQL Navigator
257/464
Chapter 6 Working with PL/SQL code 255
Session menu commands
To Use this command
-
7/26/2019 Users Guide for SQL Navigator
258/464
256 SQL Navigator Users Guide
Access to tools and add-ons for stored programdevelopment
Tools menu commands (stored procedure open)
-
7/26/2019 Users Guide for SQL Navigator
259/464
Chapter 6 Working with PL/SQL code 257
For Use this tool or add-on
-
7/26/2019 Users Guide for SQL Navigator
260/464
258 SQL Navigator Users Guide
Synchronizing advanced editing features
Viewing compiler errors
Oracle error code explanation display
To view a full Oracle error description
To view the source code corresponding to a listed error
1
2
-
7/26/2019 Users Guide for SQL Navigator
261/464
Chapter 6 Working with PL/SQL code 259
The Knowledge Xpert
-
7/26/2019 Users Guide for SQL Navigator
262/464
260 SQL Navigator Users Guide
PL/Vision Control Panel settings
Tab / Category Setting Result
General
Exceptions
-
7/26/2019 Users Guide for SQL Navigator
263/464
Chapter 6 Working with PL/SQL code 261
Tab / Category Setting Result
Logging
-
7/26/2019 Users Guide for SQL Navigator
264/464
262 SQL Navigator Users Guide
Tab / Category Setting Result
Tracing
-
7/26/2019 Users Guide for SQL Navigator
265/464
Chapter 6 Working with PL/SQL code 263
Tab / Category Setting Result
Data Conversion
-
7/26/2019 Users Guide for SQL Navigator
266/464
264 SQL Navigator Users Guide
Tab / Category Setting Result
Transaction Management
-
7/26/2019 Users Guide for SQL Navigator
267/464
Chapter 6 Working with PL/SQL code 265
Tab / Category Setting Result
File I/O
-
7/26/2019 Users Guide for SQL Navigator
268/464
266 SQL Navigator Users Guide
Tab / Category Setting Result
Knowledge Xpert
-
7/26/2019 Users Guide for SQL Navigator
269/464
Chapter 6 Working with PL/SQL code 267
Database Source Code Search
To search source code
1
2
3
You can specify the search string, schema name,and object name using wildcard characters "%"
and "_" (according to SQL LIKEoperatordefinitions).
4
To view information about the objects found
To open an object displayed in the results table
To add a code location shortcut to a workspace
-
7/26/2019 Users Guide for SQL Navigator
270/464
268 SQL Navigator Users Guide
Writing and editing stored programs
Creating a new stored program
To create a new stored program
1
2
3
4
5
6
Modifying a stored program
-
7/26/2019 Users Guide for SQL Navigator
271/464
Chapter 6 Working with PL/SQL code 269
To open a stored program for editing1
2
To insert a saved text file into the Stored Program Editor
1
2
3
To modify stored programs
Be cautious when modifying stored programs in aproduction database. Saving a program applies
the changes to the stored program on the server.
If there are compiler errors in the program code,Oracle invalidates the program on the server.
1
2
3
Faster development using the Code Explorer
-
7/26/2019 Users Guide for SQL Navigator
272/464
270 SQL Navigator Users Guide
Displaying the Code Explorer
To display the Code Explorer
-
7/26/2019 Users Guide for SQL Navigator
273/464
Chapter 6 Working with PL/SQL code 271
Rapidly locating source code segments
To quickly move the cursor to a procedure or function
Begin/End markers for loops and blocks
-
7/26/2019 Users Guide for SQL Navigator
274/464
272 SQL Navigator Users Guide
Using bookmarks in source code
To set a bookmark using a shortcut menu1
2
3
To set a bookmark using a keyboard shortcut
To list bookmarks
To go to a bookmark using a shortcut menu
1
2
3
To go to a bookmark using a keyboard shortcut
Programmable keys for PL/SQL code
-
7/26/2019 Users Guide for SQL Navigator
275/464
Chapter 6 Working with PL/SQL code 273
Compiling a stored program
To compile a stored program from the Stored Program Editor
Customizing color highlighting for PL/SQL and SQL
keywords
Converting HTML into a PL/SQL stored procedure
Correcting syntax errors
-
7/26/2019 Users Guide for SQL Navigator
276/464
274 SQL Navigator Users Guide
To highlight the line containing an error
Drag-and-drop PL/SQL editing
Correcting typing errors
Testing program code with debug statements
-
7/26/2019 Users Guide for SQL Navigator
277/464
Chapter 6 Working with PL/SQL code 275
Executing stored programs
Executing stored programs
If you have the PL/SQL Debugger, you can setbreakpoints and watch variables before execution
in Debug mode.
To execute a stored program
Creating anonymous blocks
-
7/26/2019 Users Guide for SQL Navigator
278/464
276 SQL Navigator Users Guide
..STB
To generate an execution code block
1
2
3
4
5
6
Profiling Details dialog options
Option Description
-
7/26/2019 Users Guide for SQL Navigator
279/464
Chapter 6 Working with PL/SQL code 277
Set Options dialog options
Option Description
-
7/26/2019 Users Guide for SQL Navigator
280/464
278 SQL Navigator Users Guide
Viewing results in the Output window
The Output window showing compile results with errors
-
7/26/2019 Users Guide for SQL Navigator
281/464
Chapter 6 Working with PL/SQL code 279
Viewing an Oracle error description and solution
To view an Oracle error description
Editing window, Output window, and Oracle Error Information window
Stepping though stored programs
Running stored programs in Debug mode
-
7/26/2019 Users Guide for SQL Navigator
282/464
280 SQL Navigator Users Guide
Optimizing stored programs: The PL/SQL Profiler
Optimizing stored programs with theProfiler/Coverage tool
You can launch the Profiler from the Tools menu or theFunctions toolbar
-
7/26/2019 Users Guide for SQL Navigator
283/464
Chapter 6 Working with PL/SQL code 281
To open the Profiler
Before using the Profiler, debug your stored
program, as there is no editing capability fromwithin the Profiler.
-
7/26/2019 Users Guide for SQL Navigator
284/464
282 SQL Navigator Users Guide
Viewing an open object in the DB Navigator
Using the Locate in DB Navigator command
-
7/26/2019 Users Guide for SQL Navigator
285/464
Chapter 6 Working with PL/SQL code 283
Result of the Locate in DB Navigator command
-
7/26/2019 Users Guide for SQL Navigator
286/464
284 SQL Navigator Users Guide
Using the Profiler with the Stored Program editor
-
7/26/2019 Users Guide for SQL Navigator
287/464
Chapter 6 Working with PL/SQL code 285
PL/SQL Profiler quick-reference guide
Action Node Type Command Shortcut
-
7/26/2019 Users Guide for SQL Navigator
288/464
286 SQL Navigator Users Guide
Action Command Shortcut
PL/SQL Profiler: Basic concepts
Run
Profiling data types
Group
Code Unit
-
7/26/2019 Users Guide for SQL Navigator
289/464
Chapter 6 Working with PL/SQL code 287
Executable Line
Example: Identifying an execution bottleneck
1
2
3
4
5
6
7
Example: Using the coveragefeature for quality assurance
1
2
3
4
5
-
7/26/2019 Users Guide for SQL Navigator
290/464
288 SQL Navigator Users Guide
Installing the PL/SQL Profiler
PL/SQL Profiler window
Tree views
Runs view
-
7/26/2019 Users Guide for SQL Navigator
291/464
Chapter 6 Working with PL/SQL code 289
Groups view
To view the profiling data for an item in the tree view
To select from a list of actions to perform
Interpreting PL/SQL Profiler result sets
-
7/26/2019 Users Guide for SQL Navigator
292/464
290 SQL Navigator Users Guide
Node Type Tab Result Set Description
-
7/26/2019 Users Guide for SQL Navigator
293/464
Chapter 6 Working with PL/SQL code 291
Node Type Tab Result Set Description
-
7/26/2019 Users Guide for SQL Navigator
294/464
292 SQL Navigator Users Guide
Node Type Tab Result Set Description
-
7/26/2019 Users Guide for SQL Navigator
295/464
Chapter 6 Working with PL/SQL code 293
Setting PL/SQL Profiler filters and sort options
Threshold and sorting works only if there is asingle series to be displayed in the Runs tree andCombine Runs in Group Result Setsis enabled
for the Groups tree.
Data Filters tab options
For this result Select this option
-
7/26/2019 Users Guide for SQL Navigator
296/464
294 SQL Navigator Users Guide
For this result Select this option
Chart Options tab options
For this result Select this option
-
7/26/2019 Users Guide for SQL Navigator
297/464
-
7/26/2019 Users Guide for SQL Navigator
298/464
296 SQL Navigator Users Guide
The DBMS_OUTPUT package
DBMS_OUTPUT
Using the DBMS_OUTPUT package as an aid to debugging
DBMS_OUTPUT.PUT_LINE
DBMS_OUTPUT
DBMS_OUTPUT.PUT_LINE DBMS_OUTPUT.PUT_LINE
To insert a DBMS_OUTPUT.PUT_LINE debugging statement
DBMS_OUTPUT.PUT_LINE();
-
7/26/2019 Users Guide for SQL Navigator
299/464
Chapter 6 Working with PL/SQL code 297
To produce a DBMS_OUTPUT statement for a variable
DBMS_OUTPUT(Value of = ||var_name);
Examples of DBMS_OUTPUT statements used for debugging
DBMS_OUTPUT.PUT_LINE(Reached update employee statement);
v_ename VARCHAR2
DBMS_OUTPUT.PUT_LINE(Value of Employee name is:||v_ename);
v_empno NUMBER
DBMS_OUTPUT.PUT_LINE(Value of Emp number is:||TO_CHAR(v_empno));
Viewing server output
DBMS_OUTPUT
Interpreting the output display
Color Data type
To set the Output window buffer size
-
7/26/2019 Users Guide for SQL Navigator
300/464
298 SQL Navigator Users Guide
Enabling Output for a database session DBMS_OUTPUT DBMS_OUTPUT
To set the Output window option ON
To disable the Output window option for a database session
-
7/26/2019 Users Guide for SQL Navigator
301/464
Chapter 6 Working with PL/SQL code 299
Debugging Functions, Triggers and Packages
Debugging PL/SQL with the SQL Navigator Debugger
Overview
-
7/26/2019 Users Guide for SQL Navigator
302/464
300 SQL Navigator Users Guide
-
7/26/2019 Users Guide for SQL Navigator
303/464
Chapter 6 Working with PL/SQL code 301
Debugger commands
Using the SQL Navigator debugger
-
7/26/2019 Users Guide for SQL Navigator
304/464
302 SQL Navigator Users Guide
create session
alter session
To compile a stored program or trigger with debug information
Debugging stored procedures
-
7/26/2019 Users Guide for SQL Navigator
305/464
Chapter 6 Working with PL/SQL code 303
-
7/26/2019 Users Guide for SQL Navigator
306/464
304 SQL Navigator Users Guide
Oracle version requirements for the Debugger
Feature Supported in Oracle version?
Setting watched variables
-
7/26/2019 Users Guide for SQL Navigator
307/464
Chapter 6 Working with PL/SQL code 305
my_record.field1my_table(i).field1
Increasing the number of variables in the watch
variable list may result in slower debugger
performance.
To add to the list of watched variables
1
2
3
To add arguments of a procedure to the list of watches
1
2
If a variable does not update as expected, place abreakpoint on the next executable line after the
expected update The breakpoint pauses the
debugger and updates the variables values.
To remove a watched variable name
1
2
3
-
7/26/2019 Users Guide for SQL Navigator
308/464
306 SQL Navigator Users Guide
Displaying watch variables during execution
Handling out-of scope-variables
The debugger maintains separate watch lists foreach program unit. Therefore, if a watch is
defined correctly, it will not be displayed when it
is out of scope.
The Debugger distinguishes package variablesthat belong to different namespaces:
Local
Specification
Body
You can specify the scope for a package variablefrom the Watch Properties dialog.
-
7/26/2019 Users Guide for SQL Navigator
309/464
Chapter 6 Working with PL/SQL code 307
Displaying the call stack
A brief glossary of debugging terms
-
7/26/2019 Users Guide for SQL Navigator
310/464
308 SQL Navigator Users Guide
Initiating a debugging session
To initiate debugging
1
2
3
4
Shortcuts
-
7/26/2019 Users Guide for SQL Navigator
311/464
Chapter 6 Working with PL/SQL code 309
To Choose this option
Debugging code run from an external application
id := dbms_debug.initialize(SQLNAV)
dbms_debug.debug_on;
SQLNAV initialize
dbms_debug.debug_off
-
7/26/2019 Users Guide for SQL Navigator
312/464
310 SQL Navigator Users Guide
Attaching an external session for debugging
To attach an external session for debugging
1
2
3 4
initialize
5
EXAMPLE
CREATE OR REPLACE
PROCEDURE test_proc1(n NUMBER) IS
BEGIN
. . .
END;
-
7/26/2019 Users Guide for SQL Navigator
313/464
Chapter 6 Working with PL/SQL code 311
1
2
DECLARE
id VARCHAR2(30);
BEGIN
id := dbms_debug.initialize(SQLNAV);
dbms_debug.debug_on;END;
3
BEGIN
test_proc1(123);
dbms_debug.debug_off;
EXCEPTION
WHEN others THEN
dbms_debug.debug_off;
END;
4
-
7/26/2019 Users Guide for SQL Navigator
314/464
312 SQL Navigator Users Guide
5
BEGIN
dbms_debug.debug_on;END
Setting and viewing breakpoints
A new and useful feature in this version of SQL
Navigator is its one-click ability to set and modifybreakpoints within the Stored Program Editor.
If debug mode is enabled, clicking in the gutter onthe left side of the text-editing area displays aBreakpoint properties dialog. Here you can
specify line numbers and break conditions, and
disable or enable breakpoints.
-
7/26/2019 Users Guide for SQL Navigator
315/464
Chapter 6 Working with PL/SQL code 313
To set or clear breakpoints before executing a procedure1
2
3
If you Toggle Breakpointon a line ignored
by the compiler, such as a comment, thebreakpoint will not be set. The debugger
displays an "Unable to Set Breakpoint"message when execution begins.
3
4
5
To set breakpoints during execution
1
2
To display existing breakpoints
1
2
-
7/26/2019 Users Guide for SQL Navigator
316/464
314 SQL Navigator Users Guide
Disabling breakpoints
To disable or enable a breakpoint (Debug menu)
1
2
To disable or enable a breakpoint (Execution Status window)
1
2
Setting conditional breakpoints
-
7/26/2019 Users Guide for SQL Navigator
317/464
Chapter 6 Working with PL/SQL code 315
The breakpoint condition is evaluated beforethebreakpoint statement is executed.
Example:
1 CREATE OR REPLACE PROCEDURE DEBUG_MEAS2 l_variable BINARY_INTEGER;3 BEGIN
4 l_variable := 10;5 END;
If the user sets up a breakpoint on line 4 with acondition l_variable = 3, the debugger will break
on line 4 regardless of the condition. It does sobecause at that point the statement l_variable :=
10has not been executed, and the conditionl_variable = 3will not be evaluated correctly
To define or change a conditional breakpoint
1
2
3
Option Note
4
-
7/26/2019 Users Guide for SQL Navigator
318/464
316 SQL Navigator Users Guide
Controlling code execution in the debugger
Stopping
Use caution when stopping execution. Anyuncommitted changes made by the program maybe lost.
Stepping over code
To step over code
1
2
-
7/26/2019 Users Guide for SQL Navigator
319/464
Chapter 6 Working with PL/SQL code 317
Stepping into code
To step into code
1
2
Stepping out
Run to caret
-
7/26/2019 Users Guide for SQL Navigator
320/464
318 SQL Navigator Users Guide
Evaluating and modifying variables
To evaluate or modify a variable
Testing variables
To test the result of a variable
1 2
3
4
-
7/26/2019 Users Guide for SQL Navigator
321/464
Chapter 6 Working with PL/SQL code 319
5
If you see an error such as "Not compiled with
debug info" instead of the variable value, youneed to recompile the procedure with the Debug
information and re-execute it in the debugger tosee the value of variables.
Watching CURSOR variables
flags:FFF, rowcount:RRR.
RRR
FFF
%ISOPEN
%FOUND
%NOTFOUND
C1%NOTFOUND, C1%FOUND,C1%ISOPEN, C1%ROWCOUNT
Troubleshooting the Debugger
Oracle PL/SQL Error ORA-0600 when starting the Debuggeroption
-
7/26/2019 Users Guide for SQL Navigator
322/464
320 SQL Navigator Users Guide
To install Oracle Patches for Unix1
2
3
Debugging features support by Oracle
Limitations of the Debugger option
-
7/26/2019 Users Guide for SQL Navigator
323/464
Chapter 6 Working with PL/SQL code 321
Prerequisites for running the Debugger option
ORA-04068 and ORA-04067 error messages
Setting up loopback connection on Personal Oracle7 forWindows
Caution! The listener.ora file must be editedexactly as shown. Changing the file format could
cause system problems that require additionaltechnical support.
To set up loopback connection on Personal Oracle7 for Windows
1
2