Professional Documents
Culture Documents
0
User Guide Supplement
Table of Contents
Introduction ......................................................................................................................................................... 7
Purpose of this Supplement ..................................................................................................................................... 8
iv
SQL Navigator
User Guide Supplement
Using the Execution Console ................................................................................................................ 28
Code Editor Tab...................................................................................................................................................... 28
Switching Sessions ................................................................................................................................................. 29
Toolbox ................................................................................................................................................................... 30
Code Explorer ....................................................................................................................................... 31
Outline ................................................................................................................................................... 31
DB Explorer ........................................................................................................................................... 32
Describe ................................................................................................................................................ 32
History ................................................................................................................................................... 33
Available Options .................................................................................................................................. 33
Columns ................................................................................................................................................ 34
Dependencies ....................................................................................................................................... 34
PL/SQL Debugger ................................................................................................................................. 34
PL/SQL Debugger .................................................................................................................................................. 35
Setting and Viewing Watched Variables ............................................................................................... 36
Setting and Viewing Breakpoints .......................................................................................................... 37
Evaluating and Modifying Variables ...................................................................................................... 39
National Language Support (NLS) ......................................................................................................................... 41
Table of Contents
1
Introduction
Contents
Purpose of this Supplement
SQL Navigator
User Guide Supplement
Code Editor
Toolbox
Some new functionality also had been added in SQL Navigator 5.0:
ER Diagram
CodeXpert
SQL Monitor
Autohide panels
Overviews of the new functionality are included in the next chapter of this
document. For more detailed information about each new function, refer to the
Whats New in this Release topic in the online help which contains links to more
detailed help topics.
In SQL Navigator 4.5, the original Navigator Query Builder was replaced with a
more powerful SQL Modeler tool. The SQL Editor and the Stored Program Editor in
versions prior to SQL Navigator 6.0 are also replaced with the Code Editor.
References to the Query Builder, SQL Editor and Stored Program Editor in the User
Guide should be ignored and this supplement referred to instead.
2
New Functionality in SQL
Navigator 5.0
Contents
ER Diagram
10
12
CodeXpert
15
SQLMonitor
16
16
17
Autohide Buttons
17
10
SQL Navigator
User Guide Supplement
ER Diagram
The ER (Entity Relationship) Diagram lets you quickly model a table and
graphically see the dependencies and joins to other tables.
Note
From the Schema Browser, Tables page, right-click a table and select ER
Diagram.
To ensure indexes are delivered in the correct order in a diagram, the preference
Enable Using DBA dictionary views must be set on. This can be done either when
you connect to the database using valid credentials (by selecting the Enable using
DBA views at log on option) or after a successful log on, by selecting View |
Preferences and selecting the Enable Using DBA dictionary views option.
Chapter 2
New Functionality in SQL Navigator 5.0
Note
11
The more levels of referential tables you load, the more complicated the diagram will
become, and the longer SQL Navigator will take to create the diagram.
Primary keys
Foreign keys
Unique keys
Data type
Not nullable
Indexes
If the display option has an icon associated with it, the icon is displayed to
the right of the option. In the diagram, the appropriate icon appears to the left
of the table name.
6 Click OK to generate the diagram.
Name of the table and the schema where it resides (in the title bar)
Any icons selected in the Display Options area when the diagram was created
Lines connect every two tables where one table is dependent on the other. Lines have
a knob end and an arrow end. The referencing table resides at the knob end, and the
referenced table at the arrow end.
12
SQL Navigator
User Guide Supplement
Access the Code Road Map from Object | Code Road Map.
When you first open the Code Road Map, there will be no map loaded.
Chapter 2
New Functionality in SQL Navigator 5.0
13
New Map
When you choose to create a new map, the Model Code dialog box appears. This
dialog box lets you choose what code you want to map, and what options you want
to use when it is mapped.
Schema
Choose the schema where the code you want mapped is located.
The Road Map displays two different levels: code only and code plus data.
Code Only
In the code only version, you see a graphical representation of the run-time, callstack dependencies. There are three available options for this mode:
14
SQL Navigator
User Guide Supplement
diagram, you can also include pertinent triggers and views. Views are
essentially treated as tables.
You can choose from a dropdown list of code types. SQL Navigator supports
mapping of functions, packages, procedures and triggers.
Code Unit
Objects of the type chosen above populate this dropdown for code unit.
Select the unit you want to map.
Sub Unit
If the code type you have chosen is a package, the various parts of that
package will be included in the sub unit dropdown, arranged alphabetically.
By default, the first sub unit is selected for mapping.
Levels to Model
Enter the number of levels down from your starting object that you want to
model. The default is ten.
Display Mode
Code Only - Select Code Only to model only code that the object calls.
Code + Data - Select Code + Data to model both code called and data (tables,
views, and so on) referenced by the object.
Display Options
These options only affect the visual display of the map. The data in the map
is not affected by these selections.
Chapter 2
New Functionality in SQL Navigator 5.0
15
CodeXpert
CodeXpert is a utility accessible via Editors in SQL Navigator that analyzes the code
against a set of rules for best practices. These rules are stored in a ruleset and can be
either user-defined or pre-defined.
The CodeXpert window opens as a tab within the Output Frame. The window
consists of the CodeXpert toolbars, the Results tab, the CodeXpert Report tab and the
Rules and Statements Totals.
To access CodeXpert
16
SQL Navigator
User Guide Supplement
SQLMonitor
A SQLMonitor tool is now bundled and installed automatically with SQL Navigator.
It is not accessible from SQL Navigator directly but can be accessed via the Start
menu under Quest Software | SQL Navigator 5 | SQL Monitor.
This tool enables the monitoring of connections to databases and SQL queries.
Chapter 2
New Functionality in SQL Navigator 5.0
17
CVSNT client and server 2.0.14 (or higher) with sserver, pserver, sspi, ssh,
and local.
Standard
Flat
XP
Office 2003
Autohide Buttons
The Debugger panel in SQL Navigator is now in autohide mode by default, that is, it
is hidden behind its button when SQL Navigator opens.
You can open a hidden window by pointing the mouse over the window label. Other
hidden windows such as Workspace and Output can be locked open or hidden by
clicking the pin icon located in the top right-hand corner.
18
SQL Navigator
User Guide Supplement
Note
The Debugger button is visible only when the Debug function is active.
The following screen shot shows the Workspace panel open and locked.
3
New Functionality in SQL
Navigator 6.0
Contents
All-in-one Code Editor
20
26
28
Switching sessions
29
Toolbox
30
PL/SQL Debugger
35
41
20
SQL Navigator
User Guide Supplement
Chapter 3
New Functionality in SQL Navigator 6.0
21
Press Ctrl + M.
Split/Compare
Use Split/Compare to split the current editing window in half either horizontally or
vertically, to compare different parts of the same or different scripts and stored
programs.
To split/compare the current script
1 Navigate to the tab you want to split/compare.
2 Select one of the split options from the Code Editor toolbar or the right click
menu.
To compare between different scripts/stored programs
1 Follow the steps above to split the current tab.
2 Right click and select the Second Source from Split/Compare.
Note
The Second Source is only populated with the currently open scripts/stored programs.
Selection Mode
SQL Navigator 6.0 introduces the block selection mode that allows the selection of a
rectangular block of code.
To enable block selection mode
From the Code Editor window, right click and select Edit | Selection Mode |
Block.
or
Press Alt+F7.
22
SQL Navigator
User Guide Supplement
Note
Highlight using block selection mode is limited to the length of the last line.
Select View | Preferences and select the Allow Caret after EOL option in
Code Editor | General.
Highlight as usual. Now you can see that the selection is not limited to the
length of the last line.
Editing Tabs/Spaces
SQL Navigator 6.0 provides some features to work with "invisible characters" such
as tabs and spaces.
Note
For this option to work on tabs, make sure the preference Use TAB characters in Code
Editor | General is selected.
To show tabs/eof/eol
From the Code Editor window, right click and select Edit | Show
Tabs/Eol/Eof.
From the Code Editor window, right click and select Edit | Tabs/Spaces and
select the option accordingly.
Collapse/Expand Block
Instead of displaying arrows in the gutter to signify a block of code, SQL Navigator
6.0 provides the Collapse Block functionality. You can collapse/expand a block,
procedure, loop or IF statement by clicking on the - or + symbols to hide/show
codes.
Chapter 3
New Functionality in SQL Navigator 6.0
Note
23
With scripts that are exceptionally long, collapse/expand codes may slow down the
application. You can choose to disable this feature by changing the preference.
The list is displayed only when this piece of code belongs to a stored program.
24
SQL Navigator
User Guide Supplement
Chapter 3
New Functionality in SQL Navigator 6.0
Note
25
The Value(s) field is shown depending on which Operator has been selected.
Note
Prior to SQL Navigator 6, the Script tab of the Code Editor (SQL Layout) was known as
SQL tab/window.
Procedure
Function
Package + Body
26
SQL Navigator
User Guide Supplement
You can choose to create Package and (Object) Type without a body.
If the package/type already has a body, clicking the Body button takes you to the Body
tab.
Chapter 3
New Functionality in SQL Navigator 6.0
Tip
27
If you have the PL/SQL Debugger, you can set breakpoints and watch variables before
execution in Debug mode.
When you execute a stored program, SQL Navigator starts the Execution Console,
which allows you to set the various parameters for wrapping an anonymous block
around the stored program.
Note
In SQL Navigator 6.0, the Execution Console is displayed at the bottom of the Script
window.
The following graphic shows the Code Editor (PL/SQL Layout) with the Execution
Console positioning at the bottom.
Select the stored program and then click the Run button in the Session
toolbar.
28
SQL Navigator
User Guide Supplement
Select the stored program and then from the Object menu and then choose
Execute.
In the Code Editor, run an anonymous PL/SQL block to execute the stored
program.
If you generate an anonymous block, the Console assigns a file name to your
block in the following form:
<Schema name>.<procedure name>.STB
If the anonymous block is for a packaged procedure, then the assigned name
has an additional componentthe entry point.
If an error occurs when trying to run a generated code block (for example,
due to a syntax error), the text is opened in the Code Editor.
For ease of debugging, in SQL Navigator 6.0 the Execution Console is displayed at
the bottom of the Script window. Its features include:
Set IN and OUT parameters and specify COMMIT and ROLLBACK options
for changes made by the procedure.
Chapter 3
New Functionality in SQL Navigator 6.0
29
through multiple Code Editor Tabs, you can set the preference so that tab items
expand onto multiple lines by a specified amount.
Note
View | Preferences | Code Editor | General | Allow Tab Items to Expand onto
Multiple Lines.
Switching Sessions
When using the Code Editor, you can freely switch to other sessions and continue
working within the same window, with the same script. This feature enables you to
run the same script against different databases without the need to copy it into
another instance of Code Editor. It also allows you to quickly correct the oversight of
opening a file into the wrong session.
In SQL Navigator 6.0, you can switch between sessions by clicking the Send to
Session button in the Code Editor Toolbar. You can choose from a list of current
sessions or start a brand new session.
Note
In SQL Navigator 6.0, you can send the current Code Editor tab or a selected piece of
codes to another session.
30
SQL Navigator
User Guide Supplement
Toolbox
The Toolbox provides necessary tools for editing and debugging purposes. All tools
have tab-like titles for quick activation using the mouse. Only one tool can be active
at a time.
Note
Code Explorer
Outline
DB Explorer
Describe
History
Columns
Dependencies
PL/SQL Debugger
PL/SQL Debugger is only available when the Debugger is enabled.
By default the Toolbox is displayed on the right side of the Code Editor. To change
the position of the toolbox and move among the tools, select the appropriate options
from the Code Editor shortcut menu.
You can also pin/unpin the toolbox to increase the editing space.
Chapter 3
New Functionality in SQL Navigator 6.0
Code Explorer
The Code Editor includes a Code Explorer tool that helps make your work with
packages, procedures, and functions more efficient and error-free. (The Code
Explorer is now located inside the Toolbox.)
Outline
The Outline is a graphic representation of the syntax tree of the current source.
To access the Outline Tool
31
32
SQL Navigator
User Guide Supplement
DB Explorer
Instead of switching to the DB Navigator Tree for finding and opening objects, you
can use the DB Explorer in the Toolbox. Although similar in appearance to DB
Navigator, DB Explorer is not a replacement to the familiar database browsing tool.
Rather, it is a light version of the latter integrated into Code Editor for extra
convenience.
The DB Explorer offers a simple filter to help speeding the search process.
To filter the objects in the DB Explorer tree
Type a filter phrase (for example, c% to filter all objects with names starting
with c).
Press Enter.
You can drag and drop objects from DB Explorer into the Code Editor.
Note
You can set the preference to decide the behavior of dragging and dropping table
names.
Describe
This tool displays the data structure for tables, indexes, views and synonyms. The
tool is also accompanied with a basic filter. To increase response time, the drop
down list is not populated with objects when the tool is first activated.
To use the filter
Leave the Filter blank and press Enter to show the complete list of objects.
You can also use wildcards to filter the objects. For example, type t% and
press Enter to display only objects with names starting with "t". Select an
object from the list to show its column names and types.
Chapter 3
New Functionality in SQL Navigator 6.0
33
History
In SQL Navigator 6.0, the History tool (previously called Statement Recall) is
located inside the Toolbox.
The History tool lists successfully executed SELECT, UPDATE, DELETE
commands and PL/SQL blocks up to 1000 of the most recent ones. In the History
window, each SQL statement is accompanied with the date, time and the schema that
they were executed on.
To access the History Tool
or
Note
Click the SQL History button to activate the History tab (SQL Layout only).
If the Toolbox is unpinned, pressing the button will not make History visible until the
Toolbox is shown.
Available Options
There are various options to manipulate the saved SQL statement.
Replace - To replace the current contents of the editing window with the
selected SQL statement.
Clipboard - If you want to copy and paste the statement into another
location.
New Tab - If you want to open a new Code Editor tab and paste the
statement into it.
The combo box at the bottom of the window allows you to choose which action
(New Tab, Insert, Replace or Clipboard) will be executed upon double-clicking an
entry in History.
You can also insert the statements by dragging and dropping them into the Code
Editor.
34
SQL Navigator
User Guide Supplement
Columns
The Columns window provides an easy-to-use tool to arrange and hide/show
columns of the retrieved table in the data grid. .
To access the Columns window
1 Run a valid query statement.
2 Click the Columns tab in the Toolbox.
To hide columns in the retrieved table
Select or deselect the checkbox next to each column name to hide or show
that column.
The settings are saved when you refresh or rollback the query. However if you rerun the
query, the settings are set back to the default.
Dependencies
This tool is separated into two tabs which list the Dependants and Depends On
objects of the current script. It also offers some basic functions in the shortcut menu
to manipulate the objects in the list. The available options are: Open, Describe,
Browse Data, Edit Data, and Compile.
To access the Dependencies Tool
PL/SQL Debugger
SQL Navigators Debugger is integrated into the development environment.
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.
Chapter 3
New Functionality in SQL Navigator 6.0
35
Create session
Alter session
Inside the Code Editor, right click to display the shortcut menu. Select
PL/SQL Debugger from the PL/SQL Debugger sub menu.
Make sure PL/SQL Debugger mode is ON (click the Debugger button on the
Code Editor toolbar), then compile your stored program.
You can set breakpoints and watches at any time before or during debug session.
You do not have to recompile your program after you set breakpoints or watches.
PL/SQL Debugger
In SQL Navigator 6.0, the tools and features for debugging stored programs can be
found inside the PL/SQL Debugger window located in the Toolbox. Those changes
simplify your working environment by reducing the number of floating windows.
With the new Code Editor and the new work flow you can perform all the needed
tasks without switching to other windows.
Some of the debugging features are conveniently placed in the shortcut menu of the
code editor. However, to access the full range of debugging features, click the
PL/SQL Debugger tab in the Toolbox. The available features are listed below:
To
Select
Stack tab
Locals tab
36
SQL Navigator
User Guide Supplement
To
Select
Watches tab
Breakpoints tab
Increasing the number of variables in the watch variable list may result in slower
debugger performance.
Chapter 3
New Functionality in SQL Navigator 6.0
37
To watch variables of a procedure other than the current procedure, change the
module owner and module name as needed.
If you Toggle Breakpoint on a line ignored by the compiler, such as a comment, the
breakpoint will not be set. The debugger displays "Unable to Set Breakpoint" when
execution begins.
38
SQL Navigator
User Guide Supplement
Breakpoints are colored as follows:
Yellow to distinguish the breakpoint line from the other lines of code.
If Notify is selected, the debugger will not stop at breakpoints. Instead, a message is
displayed in the output window confirming that this breakpoint has been passed.
Chapter 3
New Functionality in SQL Navigator 6.0
39
Example
1 CREATE OR REPLACE PROCEDURE DEBUG_ME AS
2 l_variable BINARY_INTEGER;
3 BEGIN
4 l_variable := 10;
5 END;
If you set up a breakpoint on line 4 with a condition l_variable = 3, the debugger will
break on line 4 regardless of the condition. It does so because at that point the
statement 'l_variable := 10' has not been executed, and the condition 'l_variable = 3'
will not be evaluated correctly.
To define or change a conditional breakpoint
1 Switch to the Breakpoints tab in the PL/SQL Debugger window and select
the breakpoint from the list.
2 Specify a condition in the Condition field.
3 Select Update from the Watch/Update menu.
When you evaluate a variable, ensure that only a single scalar variable is
selected.
Variable values in the "watch" window are updated only at the breakpoint, so
strategically place breakpoints after the watch variable.
40
SQL Navigator
User Guide Supplement
3 To modify the value, click F2 and enter the new value of the variable in
Value column, then press Enter.
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.
Chapter 3
New Functionality in SQL Navigator 6.0
41
Note
No Support
4
SQL Modeler
Contents
SQL Modeler Overview
44
Quick Start
45
46
Table Selector
47
Model Area
48
50
51
Viewing Joins
53
Building Queries
54
55
58
58
Criteria Tab
58
44
SQL Navigator
User Guide Supplement
Via the SQL Modeler menu item on the SQL Navigator Tools menu.
From the SQL Modeler button on the parent SQL Navigator window
toolbar.
The SQL Modeler dialog provides a fast means for creating the framework of a
Select, Insert, Update, or Delete statement. You can select Tables, Views, or
Synonyms, join columns, select columns, and create the desired type of statement.
You can navigate around the SQL Modeler by clicking on items or by using the
keyboard. Up and down arrow keys move through lists, the space bar selects and
deselects check boxes, and you can tab to move forward one area (table, menu, list,
etc) and Shift-Tab to move back one area.
TABLE MODEL AREA Used to graphically lay out a query. For more
information, see Model Area on page 48.
Chapter 4
SQL Modeler
45
Note
A vertical splitter between the Model Area and the Table Selector List. Drag
it left or right to see more or less detail.
There is also a Hide/Show Table List toolbar button to temporarily hide the Table
Selector and show more model details.
Quick Start
Follow this procedure to get started using the SQL Modeler.
To start the SQL modeler
1 Drag and drop Tables, Views, or Synonyms from the Table Selector to the
modeling area.
2 Drag and drop columns from one table to another to create joins between the
tables.
3 Click the checkbox by a column to select or deselect it.
4 Click the Save current model as button on the toolbar to save the model to
disk.
5 Click the Generated Query tab to view the generated SQL query, and then
click the Load into SQL Editor button to copy the query to the SQL Editor
window.
46
SQL Navigator
User Guide Supplement
Command
Create a new model
Open an existing model
Save current model as...
Save model
Print model (not implemented in this release)
Edit current model information
Edit calculated fields
Generate a SELECT statement (has dropdown to
create different types of queries)
Execute a query
Opens the Explain Plan tool window
Load into SQL Editor window
Show/Hide the Table/View/Synonym List
Save sub query and return to master query
Cancel sub query and return to master query
Edit global WHERE clauses
Chapter 4
SQL Modeler
Button
47
Command
Set Global HAVING conditions (must have Group
By condition)
View joins
Auto join objects
Percentage of zoom for SQL Modeler pane
Table Selector
The Table Selector displays the list of tables available to you for inclusion in your
SQL Model. You can select tables, views, or synonyms from the current schema or
any other schema by changing the schema drop down list.
Only those tables, views or synonyms for which you have SELECT privilege will be
listed.
Double-click each desired Table, View, Synonym, or drag and drop them from the
list to the model area. As the objects are presented on the model area, join lines are
drawn from any established foreign keys in the DDL.
To dock or undock the Table Selector dialog
48
SQL Navigator
User Guide Supplement
To add an object to the workspace
Right-click the object and select the Add to Workspace menu option.
Model Area
Use the model area to visually join or manipulate the Tables, Views, or Synonyms.
You can click a table header and drag and drop the table where you want it in the
model area.
You can establish your own joins by dragging and dropping a column from one table
to another table column. Once the line is drawn, you can double-click the line to
adjust its properties such as Inner Join vs. Outer Join, or Join Test, for example,
equal (=), less than (<), greater than (>).
If no table columns are selected, then all columns will be included in the query. If
you want only certain columns, click the checkbox for each desired column. A
checkmark is displayed in the box. The selected column's information appears in the
Criteria grid below.
Right-click the model
Copy Model Image to Clipboard Copies a bitmap image of the model to
the Windows Clipboard.
Tables
Chapter 4
SQL Modeler
49
Show
Join Text Displays the column names that comprise the joins.
Adjust Model Origin Adjusts the upper left object to the upper left
of the window.
Primary Key Shows the Table Primary Keys as "(PK)" next to each
Primary Key column.
Show Field Type Shows or hides the data type of each table
column.
SQL
Run Query in Thread Runs the query in a way that allows you to
halt it in the middle if necessary.
Auto Join All Objects Automatically joins all tables based on DDL
Foreign Key Constraints.
Toggle Screen Model Temporarily hides the Table Select list and Results
tab.
Optimize All Table Sizes minimizes the size of the tables views.
50
SQL Navigator
User Guide Supplement
Right-click each Table object
Set Table Alias Sets the Table alias.
Auto Join Automatically joins this table to others based on DDL Foreign
Key Constraints.
Show Schema Name in SQL Shows or Hides the schema name before
each table.
Invert Selection Selects columns that were unselected and vice versa.
Hide - Temporarily hides this table from the model. A hidden table will not
be included in the generated query.
Chapter 4
SQL Modeler
51
Example
To construct the following query follow the numbered steps below:
SELECT emp.empno, emp.ename, emp.job, emp.mgr, emp.sal,
emp.comm, emp.deptno
FROM emp
GROUP BY emp.deptno, emp.comm, emp.sal, emp.mgr, emp.job,
emp.ename, emp.empno
HAVING ((emp.sal + NVL (emp.comm, 0) > 4000))
8 Click OK.
View the generated query. It should appear as described above. This query selects all
the employees whose salary plus commission is greater than 4000. The NVL
command substitutes a null value in the specified column with the specified value, in
this case, 0.
52
SQL Navigator
User Guide Supplement
2 Enter criteria into the Where Cond. and Or cells of the Criteria tab. Entries
into the cells of the Criteria tab should be in the form of <operator>
<expression2>.
Example
To construct the following query follow the numbered steps below:
SELECT dept.deptno, dept.dname, dept.loc
FROM scott.dept
WHERE ((dept.deptno BETWEEN 1 AND 25)
AND (dept.deptno < 40)
AND (dept.loc IS NOT NULL)
Chapter 4
SQL Modeler
53
Viewing Joins
View joins by clicking the View Joins button on the toolbar, or by double-clicking a
join line in the Modeler.
From this dialog you can quickly see individual joins, browse through the joins, and
make changes to them.
The top two areas describe the join fields, joined from one table to another.
You can change the Join Type from Inner to Outer. The line color denotes
the type of join.
If you have selected an Outer join, you can make change which table the
outer join is performed on.
You can change the test for the join; that is, you can make it less than or
greater than, for example, instead of equal to.
54
SQL Navigator
User Guide Supplement
Building Queries
1 If you need to clear an existing query from the SQL Modeler window, click
the New Model button on the SQL Modeler toolbar.
Drag it into the data grid in the lower pane of the window, or
SQL code is automatically generated when you add table names to the work
area pane and then select column names. To view the SQL code, click the
Generated Query tab in the lower pane of the SQL Modeler window.
6 Set options, rules, and criteria for the query. For more information, see
Setting Rules, Options or Criteria for a Query on page 55.
7 You can view your query as SQL code or as a data grid by clicking the
Generated Query and Criteria tabs, respectively.
8 To test the query, click the Execute Query button. The results appear in the
Query Results tab. From here, you can copy the new query to the SQL Editor
by clicking the Load in the SQL Editor button.
Chapter 4
SQL Modeler
55
9 To save the query, in the SQL Modeler click the Save current model as
button or the Save model button. You can also choose to copy the query to
the clipboard for pasting into another window (for example, the SQL Editor).
To create a table join
1 Add two table names to the work area by double-clicking the tables in the
Table Selector area.
2 In the first table, click the column name that you want to join, and drag it to
the corresponding column name in the second table.
When the join is successfully created, the SQL Modeler draws a connecting
line that represents the join between the two table columns.
To specify criteria for a table join
1 After creating a table join (see instructions above), double-click the
connecting line joining the two columns.
2 Choose a join operator from the list, specify a join type, and then click OK.
To test a query
1 In the SQL Modeler, construct a query.
2 Click Execute query. The result appears in the Query Results tab.
To roll back changes
If the query in the SQL Modeler is an UPDATE, DELETE or INSERT statement, a
rollback will occur automatically.
To clear SQL Modeler and create a new query
56
SQL Navigator
User Guide Supplement
3 In the chosen row, click inside a cell belonging to the column for which you
are setting the rule, option or criteria.
4 When a square button appears inside the cell, click it to open the editing
window and view or set the options, rules or criteria.
When a square button appears inside the cell, you can use the spacebar or
Ctrl+Enter to open the column editing window.
Chapter 4
SQL Modeler
57
Meaning
Example
Equal To
where EMPNO=1234
>
Greater Than
where EMPNO>1234
>=
where EMPNO>=1234
<
Less Than
where EMPNO<1234
<=
where EMPNO<=1234
<>
Not Equal To
where EMPNO<>1234
!=
Not Equal To
where EMPNO!=1234
^=
Not Equal To
where EMPNO^=1234
Not equal to
where EMPNO=1234
LIKE
Like
NOT
Not
IN
In
where ENAME IN
('FRED','BARNEY')
or
where ENAME
IN('FRED','BARNEY')
BETWEEN
Between
58
SQL Navigator
User Guide Supplement
View Query in SQL Editor - copies the query directly to a SQL Editor
window.
Criteria Tab
If individual columns are selected, they will be displayed in the Criteria grid. You
can edit many of the column properties here in the Criteria grid. Table alias, Table
and Schema are not editable here.
Only fetch unique records checkbox
Applies the DISTINCT command to the query.
Null Value Subst
Double-click to enter a value to substitute for any null values. To clear the cell,
highlight it and press Delete.
Chapter 4
SQL Modeler
59
Aggregate F
Double-click to select an aggregate column function, such as Average, Count, Max,
Min, or Sum. To clear the cell, highlight it and press Delete.
Where Cond
Double-click Condition to display the Input the WHERE Definition dialog, where
you can set a condition which tests if a column is equal to (or <, >, <=, >=, <>,
LIKE, BETWEEN) a constant or another field or a condition where the selected field
is in a sub query.
To remove the WHERE definition
Display the Input the WHERE Definition dialog and click the Remove
Condition button, or highlight the appropriate cell and press Delete.
To reset the dialog box and begin the WHERE condition again
Or
Group By
Double-click to select this as a GROUP BY column. A number within parentheses
indicates the order of the columns in the GROUP BY clause. To clear the cell,
highlight it and press Delete.
Having Aggregate
Double-click to select an aggregate column function (such as Average, Count, Max,
Min, or Sum) for the HAVING clause. This allows for the following type of query:
SELECT emp.job_id
FROM employee emp
60
SQL Navigator
User Guide Supplement
GROUP BY emp.job_id
HAVING ((AVG (emp.salary) > 1500))
Best Fit (All Columns) - Sets the column width of the Criteria grid to show
all text.
Default Width (All Columns) - Sets the column width of the Criteria grid to
the default width.
Copy Query Grid Image to Clipboard - Copies the Criteria grid to the
clipboard.
5
Need more information?
Quest Software product information
You can contact Quest Software for product information in any of the following
ways:
Web page
www.quest.com
info@quest.com
info@quest.com
Web site
www.quest.com
Please refer to our Web site for regional and international office information.
62
SQL Navigator
User Guide Supplement
From SupportLink, you can do the following:
y Quickly find thousands of solutions (Knowledgebase articles/documents)
y Download patches and upgrades.
y Seek help from a Support engineer.
y Log and update your case, and check its status.
View the Global Support Guide for a detailed explanation of support programs,
online services, contact information, and policy and procedures. The guide is
available at: http://support.quest.com/pdfs/Global Support Guide.pdf.