PLSQL Manual
PLSQL Manual
PLSQL Manual
1
User’s Guide
January 2003
4 PL/SQL Developer 5.1 User’s Guide
Contents
CONTENTS...............................................................................................................................................3
1. INTRODUCTION.........................................................................................................................7
2. INSTALLATION........................................................................................................................10
2.1 SYSTEM REQUIREMENTS........................................................................................................10
2.2 WORKSTATION INSTALLATION..............................................................................................10
2.3 SERVER INSTALLATION..........................................................................................................10
2.4 UNINSTALLING PL/SQL DEVELOPER....................................................................................10
3. WRITING PROGRAMS............................................................................................................11
3.1 CREATING A PROGRAM..........................................................................................................11
3.2 SAVING A PROGRAM..............................................................................................................12
3.3 MODIFYING A PROGRAM.......................................................................................................13
3.4 COMPILING A PROGRAM........................................................................................................13
4. TESTING PROGRAMS............................................................................................................15
4.1 CREATING A TEST SCRIPT.....................................................................................................15
4.2 EXECUTING A TEST SCRIPT...................................................................................................16
4.3 VARIABLE TYPES...................................................................................................................17
4.4 SAVING TEST SCRIPTS...........................................................................................................18
4.5 TRACKING RUN-TIME ERRORS...............................................................................................19
4.6 PACKAGE STATES & JAVA SESSION STATES..........................................................................19
4.7 VIEWING RESULT SETS..........................................................................................................19
4.8 VIEWING DBMS_OUTPUT.......................................................................................................19
4.9 VIEWING HTP OUTPUT..........................................................................................................20
4.10 DEBUGGING...........................................................................................................................20
4.11 TRACING EXECUTION............................................................................................................23
5. OPTIMIZING.............................................................................................................................25
5.1 USING THE EXPLAIN PLAN WINDOW....................................................................................25
5.2 AUTOMATIC STATISTICS........................................................................................................26
5.3 THE PL/SQL PROFILER.........................................................................................................27
5.4 SQL TRACE...........................................................................................................................28
6. AD HOC SQL..............................................................................................................................30
6.1 USING THE SQL WINDOW.....................................................................................................30
6.2 RESULT GRID MANIPULATION................................................................................................31
6.3 QUERY BY EXAMPLE MODE..................................................................................................35
6.4 LINKED QUERIES...................................................................................................................36
6.5 SUBSTITUTION VARIABLES....................................................................................................36
6.6 UPDATING THE DATABASE....................................................................................................37
6.7 VIEWING AND EDITING XMLTYPE COLUMNS.....................................................................38
6.8 DIRECT QUERY EXPORT........................................................................................................38
6.9 SAVING SQL SCRIPTS...........................................................................................................38
7. THE COMMAND WINDOW...................................................................................................39
7.1 ENTERING SQL STATEMENTS AND COMMANDS....................................................................39
7.2 DEVELOPING COMMAND FILES..............................................................................................40
7.3 SUPPORTED COMMANDS........................................................................................................41
8. CREATING AND MODIFYING NON-PL/SQL OBJECTS.................................................43
8.1 THE TABLE DEFINITION EDITOR.............................................................................................43
8.2 THE SEQUENCE DEFINITION EDITOR......................................................................................53
PL/SQL Developer 5.1 User’s Guide 5
14.9 MACROS..............................................................................................................................121
14.10 CODE CONTENTS................................................................................................................123
14.11 HYPERLINK NAVIGATION...................................................................................................123
14.12 BROWSE BUTTONS..............................................................................................................124
15. THE QUERY BUILDER.........................................................................................................125
15.1 CREATING A NEW SELECT STATEMENT...............................................................................125
15.2 MODIFYING AN EXISTING SELECT STATEMENT...................................................................128
15.3 MANIPULATING THE QUERY DEFINITION.............................................................................128
15.4 QUERY BUILDER PREFERENCES..........................................................................................129
16. THE PL/SQL BEAUTIFIER...................................................................................................131
16.1 DEFINING THE OPTIONS.......................................................................................................131
16.2 DEFINING THE RULES..........................................................................................................132
16.3 USING THE BEAUTIFIER.......................................................................................................133
17. TEMPLATES............................................................................................................................134
17.1 THE TEMPLATE WINDOW....................................................................................................134
17.2 USING A TEMPLATE.............................................................................................................135
17.3 CREATING AND MODIFYING TEMPLATES.............................................................................136
18. WINDOW LIST........................................................................................................................141
19. HELP SYSTEMS......................................................................................................................142
19.1 MS HELP FILES....................................................................................................................142
19.2 HTML MANUALS................................................................................................................142
20. CUSTOMIZATION..................................................................................................................145
20.1 PREFERENCES......................................................................................................................145
20.2 WINDOW LAYOUT................................................................................................................145
20.3 ON-LINE DOCUMENTATION..................................................................................................145
20.4 LOGON HISTORY..................................................................................................................147
20.5 COMMAND-LINE PARAMETERS............................................................................................148
20.6 SQL, PL/SQL, COMMAND, JAVA AND XML KEYWORDS...................................................149
20.7 PLUG-INS.............................................................................................................................149
PL/SQL Developer 5.1 User’s Guide 7
8 PL/SQL Developer 5.1 User’s Guide
1. Introduction
PL/SQL Developer is an Integrated Development Environment (IDE) for developing stored program
units in an Oracle Database. Using PL/SQL Developer you can conveniently create the server-part of
your client/server applications.
As a worst-case scenario, up to now you might have been working like this:
You use a text editor to write program units (procedures, triggers, etc.).
You use Oracle SQL*Plus to compile the source files.
If there is a compilation error, you have to find out where it is located in the source file, correct it,
switch back to SQL*Plus to recompile it, only to find the next error.
You use SQL*Plus or the client-part of your application to test the program unit.
In case of a runtime error, again you have a hard time locating the cause of the problem and
correcting it.
You use the Explain Plan utility or tkprof to optimize your SQL statements.
To view or modify other objects and data in your database, you use SQL*Plus or yet another tool.
These tasks - editing, compiling, correcting, testing, debugging, optimizing and querying - can all be
performed without leaving PL/SQL Developer's IDE. Furthermore, PL/SQL Developer provides several
other tools that can be helpful during everyday PL/SQL development.
PL/SQL Developer 5.1 User’s Guide 9
Editing
PL/SQL Developer, like any other serious development environment, assumes that you store your
source files on disk. Other tools just let you edit sources in the database, but this does not allow for any
version control or deployment scheme. The source files can be run through SQL*Plus, so you can
deploy them on any platform without using PL/SQL Developer. You can edit many files at once
through a standard multiple document interface.
The editor offers a wide range of assistance to the programmer. There is context sensitive help on SQL
statements and PL/SQL statements. We've all been there: you start typing substr, but have forgotten the
exact meaning of the parameters. Now you can simply hit F1 and you're taken to the appropriate topic
in the SQL Reference Manual. Tables, views and program units can be described for you in a roll-up
window from within the editor in the same way. A Code Assistant is integrated into the editor that
automatically displays information of database objects as you type their name, allowing you to browse
and pick elements from this description. For large package or type bodies, the program editor provides a
tree view with the code contents for easy navigation, provides browse back and forward buttons, and
provides hyperlink navigation. The Query Builder allows you to graphically create select statements.
PL/SQL Developer’s extensible templates make it easy to insert standard SQL and PL/SQL code into
your programs. Al editors use the appropriate SQL, PL/SQL and SQL*Plus syntax highlighting to make
your code more readable.
Optimizing
To optimize the SQL statements in your program units, Oracle's Explain Plan utility can be a big help.
Therefore it is integrated into PL/SQL Developer's IDE. By simply selecting the SQL statement in the
source file and pressing F5, the query plan is visually presented to you in a separate Explain Plan
window. You can then modify the statement to optimize its query plan outside the source file, and copy
it back afterwards.
10 PL/SQL Developer 5.1 User’s Guide
You can also view statistics about executed SQL statements and PL/SQL program units. These statistics
can include elapsed time, CPU time, logical reads, physical reads, physical writes, and so on.
Oracle8i introduced a PL/SQL Profiler that allows you to profile your PL/SQL code. For each executed
line of PL/SQL code you can determine the execution time, and how many times it was executed.
Querying
To query the data in the database, you can use a SQL window to execute any SQL statement. All
executed statements are kept in a history buffer, so you can easily re-execute them. Any query results
are conveniently displayed in a separate grid that you can subsequently use to insert, update, or delete
records. The result grid can additionally be used in a Query By Example mode, so that you can easily
find the information you need.
To query database objects you can use the Object Browser. All relevant properties of database objects
such as tables, views, sequences, functions, procedures, packages, types and triggers can be viewed,
including any dependencies between the objects. The browser uses a tree view similar to the explorer in
Windows for easy point-and-click browsing.
Reporting
PL/SQL Developer comes with a number of standard reports, which are HTML based. You can view
these reports within PL/SQL Developer, print them, or save them as HTML files. You can also create
your own custom reports. Reports can be made easily accessible from the reports menu.
Projects
To organize your work you can use PL/SQL Developer’s project concept. A project consists of a
number of files and database objects. These objects are easily accessible through the Project Items
Window, and can be compiled through a single mouse-click.
Tools
PL/SQL Developer provides several tools that can be helpful during development. These tools include a
Find Database Object tool, allowing you to search for text in database object sources, a Compile Invalid
Objects tool, to quickly compile objects that have become invalid during development, a Table Export
and Import tool, an Export User Objects tool to export the DDL statements of a user’s objects, a
Compare User Objects tool to compare the object definitions of 2 users, a Session information tool, and
an Event monitor.
In addition to these standard tools, you can define your own tools and include them in PL/SQL
Developer’s tools menu.
PL/SQL Developer 5.1 User’s Guide 11
2. Installation
There are basically two ways to install PL/SQL Developer:
Workstation installation. In this case you install the software locally on each workstation that it
will be used on.
Server installation. In this case you install the software on a server at a location that can be
accessed from each workstation that it will be used on.
Both installation types will be explained here.
You can select a destination directory for the program files, a folder in the start menu, a location for a
shortcut to PL/SQL Developer on the desktop, and installation options. After pressing the Finish button
on the final page, the program files are copied and the shortcuts are created.
3. Writing programs
In an Oracle database, you can distinguish five different types of stored program units: functions,
procedures, packages, types and triggers. The Program editor allows you to create and modify these five
types of program units in one uniform way.
As the title of this dialog suggests, this information comes from a template. PL/SQL Developer provides
several standard templates, which you can modify as needed. You can also define new templates.
Information about defining templates is provided in chapter 17.
After you have entered the variables and pressed the OK button, a Program Editor Window appears with
a template function in it. Each program you create in the Program Editor unit must start with the
familiar 'create or replace' SQL syntax. In this case we are creating a function 'even', and the source file
could look like this:
At the left side of the editor you see the Code Contents, which displays variables, constants, types,
exceptions and local functions and procedures of the program unit. This is useful for large program
units such as package bodies and type bodies. This feature is described in detail in chapter 14.10.
A program file can contain more than one program unit. By right clicking in the Program Editor, a
popup menu appears that allows you to add or delete a program unit. You can switch between the
program units by selecting the appropriate tab at the top oft the window. This way you can conveniently
PL/SQL Developer 5.1 User’s Guide 13
keep related program units together in one source file. A package specification and body are a good
example of this feature.
A program unit should be positioned after any other program unit in the program file it might reference.
If you create a function 'odd' that references the previously created function 'even', the program editor
should look like this:
The saved program file has a format that is compatible with Oracle SQL*Plus. As an example, the
source file containing the 'odd' and 'even' function looks like this:
When this file is executed through SQL*Plus, both functions will be created.
If an error message is displayed in a message box after compilation, this means that the create statement
failed without actually compiling the source. The error message should explain the cause of the error. If
for example you get the 'create or replace' syntax wrong, it will say "ORA-00900: Invalid SQL
statement" in a message box.
Note: If you are using Oracle Server 7.2 or earlier, a trigger compilation error is always reported in a
message box. Only since Oracle Server 7.3, trigger compilation errors are reported in the same way as
procedures, functions, packages and types.
16 PL/SQL Developer 5.1 User’s Guide
4. Testing programs
After successfully compiling a program, you'll need to test it. To achieve this, you can use PL/SQL
Developer's Test Scripts. A Test Script allows you to execute one or more program units, define input,
output and input/output variables and view and assign values to variables. If a run-time error occurs
during execution of the Test Script, you can view the sources of the program units that were involved in
the error.
If you are using Oracle 7.3.4 or later you can use PL/SQL Developer’s integrated debugger. You can
step through your code, set breakpoints, view and set variables, view the call stack, and so on.
The PL/SQL block contains a simple call to the function that we want to test, and uses variables
deptname and empno. We'll have to assign a value to empno, and after execution, check the value of
deptname to determine if the function returned the correct value.
PL/SQL Developer 5.1 User’s Guide 17
By prefixing these variables with a colon, they can be declared at the bottom of the Test Script:
The Scan source for variables button () at the upper-left of the variables list can be used to quickly
copy the variables from the source. After this, the integer data type and value 7369 (Mr. Smith from the
research department) is assigned to empno. Now we're ready to execute the script.
You can also declare variables locally in a declare part of the PL/SQL block, but you will not be able to
modify or view the values of these variables. An advantage of these local variables is the fact that you
can use record types, PL/SQL tables, types and so on.
The result of the function is 'RESEARCH', so it obviously functions correctly. At the bottom of the
window, the execution time is displayed. This information can be used to optimize your code for
performance. For optimization purposes you can also view the statistics of the execution of the PL/SQL
block by selecting the Statistics tab. You can also create a profile report for each executed line of
PL/SQL code by pressing the Create Profiler report button before executing the script. After execution
you can switch to the Profiler page to view the report. Statistics and Profiler reports are explained in
chapter 5.2 and 5.3 respectively.
18 PL/SQL Developer 5.1 User’s Guide
You can abort a running Test Script by pressing the Break button, which is particularly useful when a
program is stuck in an endless loop, or execution is taking longer than expected. Note that pressing the
Break button will not always be successful. If for example the program is waiting for a lock, it will not
respond to a break signal.
After executing a script, a transaction may have been started by the program units that were executed.
The Commit and Rollback button on the toolbar will be enabled if this is the case. For more information
about transactions, see chapter 11.
Boolean variables
When you select the variable type list-box, you will notice that the Boolean data type is missing. This is
because SQL*Net does not support this data type. To use a Boolean variable, you can declare it as an
integer and use the sys.diutil.bool_to_int and sys.diutil.int_to_bool functions provided by Oracle. These
functions convert between null/true/false and null/0/1. If you use the Test function in the Browser, this
conversion is automatically generated for you.
Note: You cannot open a SQL*Plus script again as a Test Script. If you want to reuse it in a Test
Window, make sure you save it as a Test Script as well!
20 PL/SQL Developer 5.1 User’s Guide
At the top you see a tab for each program unit involved in the run-time error. The program units have
been called in right to left order. You can flip through the tabs to easily find the program flow that lead
to the error. In this case it shows that the Test Script has called function employee.deptname. This
obviously can get more complicated and even go across triggers.
Note: If you are using Oracle Server 7.2 or earlier, trigger source will not be shown in the error stack
window.
The error stack highlights each line that was involved in the error in red. For the last program unit in the
stack this is the line that caused the error. For all other program units this is the line where the call to the
next program unit was made.
this page you can additionally set the size of the output buffer or enable/disable buffering. The default
settings on the output page are controlled by the output preferences as described in chapter 13.1.
4.10 Debugging
For those programming errors that are really hard to track, the Test Window provides an integrated
debugger. At the top of the window you find a toolbar with functions related to the debugger. To start a
debug session, just press the Start button at the left of the debug toolbar instead of the Execute button in
the main toolbar. The other buttons are now enabled and you are ready to debug.
Controlling execution
After starting the debugger, execution will pause before the first statement in the Test Script. After this,
you can control execution with the buttons in the debug toolbar:
Run the script until completion.
Step into a procedure, function or method call on the next line. If the next line contains an update,
insert or delete statement that will cause a trigger to be fired, you will step into that trigger.
Step over the next line. It will be executed, but you will not step into the source.
Step out of the current program unit.
Run until an exception occurs. Execution will be paused on the line that causes the exception.
After the next step the exception will actually be raised.
Whenever you step into a program unit, its source will automatically be loaded into the Test Window.
The bottom of the editor panel will now show tabs for each program unit, so that you can easily switch
between them to view the source, set/remove breakpoints, and so on. By right-clicking on the editor
panel you can remove a program unit from the Test Window if you are no longer interested in it:
22 PL/SQL Developer 5.1 User’s Guide
From the same popup menu you can also select to add the variable to the watch list, which means that
after each debug step the variable value will automatically be displayed and updated in the watch list at
the bottom-left of the Test Window.
If a variable is a collection (a PL/SQL table, varray or nested table) of a scalar data type you can view
the entire collection by right clicking on it and selecting View collection variable from the popup menu.
Note that variable values can only be viewed and set if the program units are compiled with debug
information. A preference exists that will cause each compilation to include debug information, and you
can manually add debug information by right-clicking on a program unit in the Browser and selecting
the Add debug information item from the popup menu.
Using Breakpoints
Breakpoints can be used to halt program execution on a certain line in your PL/SQL code. When
execution halts, you can view and set variables, step through the code, and so on. You can define a
PL/SQL Developer 5.1 User’s Guide 23
condition for a breakpoint, in which case execution will only be halted when this condition is met. For
each breakpoint you can define a message that will be placed in the output page when the breakpoint is
reached.
Setting breakpoints
There are two ways to set breakpoints: in a Program Window or in a Test Window. In both cases you
simply need to click on the appropriate line in the left margin of the editor. A breakpoint mark will
appear, indicating that a breakpoint is present on that line. When you execute a Test Window in debug
mode, execution will stop if one of the breakpoints is encountered.
If you set a breakpoint in a Program Window, it can be that this particular program unit has not yet been
compiled into the database. Therefore, such a breakpoint cannot be applied to the database yet either. In
this case the breakpoint mark will have a different appearance. When you subsequently compile the
program unit, the breakpoint will be applied and the corresponding mark will change to reflect this. As
long as the program unit is not compiled, any previously set breakpoints in this program unit will be
effective.
You cannot set breakpoints in the PL/SQL block of the Test Script.
To delete a breakpoint, simply click on the breakpoint mark again.
Breakpoint conditions
Sometimes you define a breakpoint on a line that is executed very often, even though you are only
interested in the program status under certain circumstances. In that case you can define a condition for
the breakpoint. Execution will only halt when the condition is met.
To define a condition for a breakpoint, right-click on the mark and select the Modify Breakpoints item
from the popup menu. The following dialog will appear:
In this dialog you see all program units that have breakpoints, with the breakpoints listed below them.
Each breakpoint has a checkbox that can be used to enable or disable it. The bottom section displays the
following fields:
Use Condition – The checkbox enables or disables the condition. The condition itself should be a
boolean expression. When the breakpoint line is reached, execution will only be halted if the
condition evaluates to True. You can use any SQL expression in the condition, and you can use
24 PL/SQL Developer 5.1 User’s Guide
any variable that is known at the location of the breakpoint. These are the same variables that you
can view or set during interactive debugging. Variables should be preceded with a colon. For
example upper(:ename) = ‘SMITH’ is a valid condition if ename is a valid variable at the
breakpoint location.
Use Message – The checkbox enables or disables the message. When the breakpoint line is
reached, and if the conditions are met, the message will be placed on the output page.
Don’t Break – This checkbox is only useful if you also define a message. When it is checked,
execution is never halted on this breakpoint line. This way you can define breakpoints that only
generate messages on the output page.
Use Pass Count – This checkbox enables or disables the pass count, which defines how many
times the breakpoint line must be passed before execution is halted. If, for example, you define a
pass count of 10, execution will halt every 10th time the breakpoint line is reached.
Debugger preferences
In the Preferences item in the Tools menu you can find a section of debugger related preferences. These
preferences are described in detail in chapter 13.1.
You can control if you want to trace specific events in each program unit (All), only in those program
units that are compiled with debug information (Enabled), or never (None).
PL/SQL Developer 5.1 User’s Guide 25
To create a Trace report, simply press the Create Trace report on the toolbar of the Test Window and
execute your Test Script. After execution you can switch to the Trace tab page to view the report, and to
view reports of previous runs:
In this (simple) report you can see that a select statement on line 15 of function employee.deptname
raised exception 1403 (No data found), which was handled on line 27 in the same program unit.
For each traced event, you can include information in the report like the event description, time,
program unit, line number, exception, and so on. To configure this, press the Preferences button at the
upper left of the Trace toolbar. This will bring up the Trace preferences page as described in chapter
13.1.
To view old trace reports, select a previous trace run from the Run selection list. Press the Delete Run
button to delete the currently selected run.
For more information on the Oracle Trace facility, see the DBMS_TRACE chapter in the Oracle
Supplied Packages Reference manual.
26 PL/SQL Developer 5.1 User’s Guide
5. Optimizing
To optimize the SQL statements in your program units, Oracle's Explain Plan utility can be a big help
by showing the execution path of a statement. Therefore it is integrated into PL/SQL Developer's IDE.
To view the actual resource use of a SQL statement or PL/SQL program unit, PL/SQL Developer can
display statistics about its execution. You can configure which statistics you wish to display, and can
include elapsed time, CPU time, logical reads, physical reads, physical writes, and so on.
To determine the execution time of each individual line of PL/SQL code, you can use the PL/SQL
Profiler. This feature is not available on Oracle 8.0 or earlier.
Finally, you can use Oracle's tkprof utility to get resource use information about all executed SQL
statements in a program unit by enabling SQL Trace.
You can now change the SQL statement and press the Execute button again to see the impact of the
changes. For more information about execution plans, you can read Oracle’s Server Tuning manual.
To see the effect of different optimizer goals on the query plan, select the corresponding entry from the
Optimizer goal list. The plan will immediately be updated to reflect these changes.
Use the First, Previous, Next, and Last operation buttons to navigate through the query plan in order of
operation. After the plan has been determined, the first operation will be highlighted.
The Explain Plan utility uses a so-called plan table to store the execution plan. If such a table is not
available to the current user, PL/SQL Developer will ask you if it should create this table in the schema
of the current user. To define which columns from the plan table you want to see, and in which order,
press the Preferences button. This will bring up the corresponding preference page (see chapter 13.1).
Note: If you are using Oracle Server 7.2 or earlier, the cost and cardinality are not available in the plan
table. If you are using Oracle Server 7.3 or higher and cost and cardinality are not displayed, you
probably need to upgrade the plan table.
If you right-click on the Object name column, this will bring up the popup menu for the selected object.
PL/SQL Developer 5.1 User’s Guide 27
Now the Explain Plan utility knows which identifier is a column, and which identifier is a PL/SQL
variable.
For each statistic you see the value of the last execute, and the total for the current session. You can
configure if and which statistics are displayed by setting a preference, as described in chapter 13.1. The
default set of statistics is relevant to the tuning of your SQL and PL/SQL, and is described here:
Statistic Meaning
CPU used by this session The CPU usage in hundredths of a second
Physical reads The number of blocks read from disk
Physical writes The number of blocks written to disk
session logical reads The number of blocks read from the block buffer or from disk
sorts (disk) The number of sorts performed in a temporary segment
sorts (memory) The number of sorts performed in memory
sorts (rows) The number of rows that were sorted
table fetch by rowid The number of rows fetched by rowid, usually as a result of index accesses
table scan blocks gotten The number of blocks read for full table scans
table scan rows gotten The number of rows read for full table scans
table scans (long tables) The number of full table scans on long tables
table scans (short tables) The number of full table scans on short tables
Which other statistics you can include depends on the version of the Oracle Server and are not described
in this manual. If you wish to get information about them, there are many Oracle tuning books available
that address this topic. The Oracle Server Reference also briefly describes these statistics.
The statistics can be exported to a CSV file (Comma Separated Values) that can be opened in a spread
sheet application later. Just right-click on the statistics, select the Export item and choose the CSV file
item. You can alternatively select a TSV, XML or HTML format, or copy it to the clipboard.
The following example report shows that in the employee.deptname function, the select statement took
149 milliseconds, and the 3 dbms_output calls took 57 milliseconds:
By default the Profiler page will display the report of the last run. You can also select previous runs
from the Run list. The Unit list allows you to zoom in on a specific program unit of a run.
The Total time column shows a graphical representation of the relative time of the line, compared to the
line with the highest time. This allows you to quickly identify the lines that are most expensive. The
report can be sorted by pressing on the sort-buttons in the heading of the columns.
If a source line is displayed in red, this means that the program unit has been changed since the profile
report was created. Therefore the displayed line of code can now be different than when the profile was
created.
You can change various layout aspects of the Profiler report by pressing the Preferences button. This
will bring up the corresponding preference page, as described in chapter 13.1.
For more information about the PL/SQL Profiler, see the dbms_profiler chapter in the “Oracle8i
Supplied Packages Reference” manual.
Note: not all platforms provide equally accurate timing information.
********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************
begin
:deptname := employee.deptname(:empno);
end;
SELECT DEPT.DNAME
FROM
DEPT,EMP WHERE EMP.EMPNO = :b1 AND DEPT.DEPTNO = EMP.DEPTNO
6. Ad hoc SQL
Often during program development you need to execute some SQL statement. Either to test the SQL
statement, to view data in a table, or to update data. You can do this from within PL/SQL Developer by
using the SQL Window.
The SQL statement is executed and 10 rows have been retrieved. The result set is larger than 10 rows,
which is indicated by the fact that both the Next Page and Last Page buttons on the lower right of the
window are enabled, and the fact that (more…) is displayed on the status line. Only 10 are initially
retrieved because this is the number of records that can be displayed on the grid. Pressing the Next Page
will retrieve the next 10 rows, and so on. Pressing the Last Page button will retrieve all rows.
If you select a part of the text in the SQL Editor, only the selected text will be executed. This way you
can have more than one statement in the editor, and execute them one by one.
If you execute a SQL statement that takes a long time to finish you can press the Break button to abort
it. Note that pressing the Break button will not always be successful. If for example the statement is
waiting for a lock, it will not respond to a break signal. If you have pressed the Break button when the
SQL Window is retrieving rows, it will simply stop and display the rows that have already been
retrieved. You can now continue retrieving records with the Next Page and Last Page buttons.
Note that the SQL Window preferences allow you to determine how many rows are initially retrieved
for a select statement. This is described in chapter 13.1.
At the right side of the window you see two buttons that allow you to navigate through all SQL
statements that you have entered in the SQL Window. This way you can quickly re-execute statements
entered previously.
32 PL/SQL Developer 5.1 User’s Guide
For optimization purposes you can view the statistics of the execution of the SQL statement by selecting
the Statistics tab. Statistics are explained in chapter 5.2.
When you print a SQL Window, the SQL statement and the result grid will be printed. By selecting
rows in the result grid, you can limit the amount of rows that will be printed.
When you click on the cell button of a Long or CLOB column, a standard text editor opens up with its
value. You can also click on the cell button of character columns to open up this text editor. The cell
button is only present if the column size is larger than 20 characters.
When you click on the cell button of a Long Raw, BLOB or BFILE column, a file dialog opens up that
allows you to export its value to a file.
Next to the OK and Cancel button, you see an XML Syntax Highlighting button. When pressed, the
XML syntax is highlighted, and the Validate XML button is enabled. Pressing this validation button will
parse the XML document, and will report any errors. This requires that you have Net8 8.1 or later, and
that the user has access to the SYS.XMLTYPE type or the XMLPARSER package.
A column selection can now be moved by releasing the mouse button, clicking on one of the selected
column headings again, and dragging the selection to the new location.
34 PL/SQL Developer 5.1 User’s Guide
To select a specific range of cells, move the mouse pointer over the left edge of a cell until its shape
changes, press the mouse button, and drag the mouse to highlight the selection:
To select all rows and columns, press the upper left cell, or right-click on the grid and select the Select
All item from the popup menu.
The highlighted selection can be copied or printed as usual.
Exporting data
There are several ways to export the data in the result set grid. After executing a select statement, you
can select a range of cells as described above, right-click on it, and select the Export Results item from
the popup menu. This will display a submenu where you can choose to export the data in CSV format
(Comma Separated Values), TSV format (Tab Separated Values), HTML format, or XML format. After
selecting the format, you can specify the export file.
You can alternatively copy the selection to the clipboard by pressing Ctrl-C, or by right-clicking on the
selection and selecting the Copy or Copy with Header item from the popup menu. You can subsequently
paste this data in another application like a spreadsheet, word processor, an so on.
To quickly manipulate the result set information in Microsoft Excel, select the Copy to Excel item. This
will open a new Excel instance, and all selected data will be copied.
Sorting rows
To sort the rows in a result grid, press the heading button of the column on which you want the rows to
be sorted:
The rows will be sorted in ascending order, as indicated by the heading button. Pressing the heading
button again will sort the rows in descending order. Pressing it a 3rd time will undo the sorting. Pressing
the heading button in another column will sort the rows on this column, but will also use the previous
sort column as the secondary sort column (indicated by the dot in the heading button). In the example
above, the job column is the primary sort column, and the hiredate column is the secondary sort
column.
Note that sorting is performed locally, and only for the rows that are already retrieved. If you retrieve
additional rows after sorting the results, these new rows will be added at the end of the result grid,
without any sorting. For large result sets, local sorting can take a long time. In this case it might be
better to use an order by clause in the select statement and let the Oracle Server do the sorting.
PL/SQL Developer 5.1 User’s Guide 35
Now each row displays a single column name and value. The Next Record and Previous Record on the
grid toolbar can be used to navigate through the result set. To switch back to the Multi Record View,
press the Single Record View button again.
36 PL/SQL Developer 5.1 User’s Guide
As soon as you have entered a query value the original SQL text will be modified to reflect the new
query criteria. Pressing the Query By Example button again, or pressing the Execute button, will execute
the modified query and display the restricted results. Press the Query By Example button again to
continue with the previous query values. Press the Clear record button to clear the query values.
Query values are not restricted to single values with wildcard characters. You can use the following
expressions (alternative expressions between square brackets):
value [= value]
value with wildcards [like value with wildcards]
> value
< value
!= value [<> value]
in (value1, value2, ...)
between value1 and value2
null [is null]
not null [is not null]
Note that if you use a literal value, you can omit quotes for character values (e.g. SMITH will
automatically be converted to ‘SMITH’ in the SQL text). For all other expressions you must provide a
literal value that the Oracle Server understands (e.g. != ‘SMITH’). This is also the case for number and
date values. If you use it in an expression, use a format that the Oracle Server understands.
Several preferences exist that allow you to control the default behavior of the Query By Example
functionality (e.g. case sensitivity). Chapter 13.1 describes these preferences.
PL/SQL Developer 5.1 User’s Guide 37
The top section displays the parent tables (and the foreign key names), and the bottom section displays
the child tables. The dept item will generate a query for this employee’s department (30). The first
(parent) emp item will generate a query for this employee’s manager (7839). The second (child) emp
item, will generate a query for all employees that are managed by this employee.
The linked query will be executed in the same SQL Window, unless you enable the SQL Window
preference Linked Query in New Window (see chapter 13.1). If you hold down the Ctrl key while
pressing the Linked Query button, the opposite of this preference will occur.
By specifying &deptno in the SQL text, you will be prompted for a value for this variable. The variable
reference in the SQL text will be substituted by this value before execution. You can specify more than
one substitution variable, and you can specify a single substitution variable more than once.
38 PL/SQL Developer 5.1 User’s Guide
Furthermore you can define the data type, default value, selection lists, list queries, checkboxes, and
other advanced options. These features are also used in the Report Window, and are described in detail
in chapter 9.
You should be aware that a select ... for update statement will lock all selected records, so including the
rowid might generally be the best way to make a result grid updateable. If the select statement is a join,
columns of the first table can be updated. All other columns will be read-only. Columns that are given
an alias cannot be updated either.
If the result grid is updateable, you can press the Edit data button at the right side of the result grid and
edit the records. You can insert or delete records on the grid by pressing the Insert record or Delete
record button. If you have selected multiple records, all selected records will be deleted.
Modifying the result grid does not actually change anything in the database. To post the updated,
inserted or deleted records to the database press the Post changes button. If you have the AutoCommit
SQL Window option disabled, the Commit and Rollback button on the toolbar will be enabled if a
transaction has been started. For more information about transactions, see chapter 11.
Only the id column will show up in the result set. To view the XML data, use the getclobval() member
function:
This way the CLOB can be viewed in the Text Editor, and XML syntax highlighting will automatically
be applied. To edit the XML data, make the result set updateable as usual by including the rowid:
Now you can edit the CLOB and post the modified data to the database. Note that the View Data and
Edit Data functions for tables and views will automatically apply these rules, so the easiest way to view
or edit XMLTYPE columns is to right-click on the table or view, and selecting the corresponding items
from the popup menu.
Command Meaning
statements is displayed
SET VER[IFY] [ON | OFF] Determines if substitution variables are displayed when used
in a SQL statement or PL/SQL block
SHO[W] ERR[ORS] [Type Name] Displays errors for the previous compilation, or for the
specified object
SHO[W] REL[EASE] Displays Oracle release information for the current
connection
SHO[W] SQLCODE Displays the result code of the executed SQL statement
SHO[W] USER Displays the username of the current connection
SPO[OL] [Filename | OFF] Starts or stops spooling
STA[RT] [Filename] [Parameter list] Runs the specified command file, passing the specified
parameters
STORE SET [Filename] Stores the values of all options in the filename. You can
execute this file later to restore these options.
UNDEF[INE] Variable Undefines the given substitution variable
VAR[IABLE] [Variable] [Datatype] Defines a bind variable, displays a bind variable, or displays
all bind variables.
WHENEVER [OSERROR | SQLERROR] [Action] Specify an action whenever an OS error or SQL error
occurs. The action can either be EXIT or CONTINUE,
optionally followed by COMMIT or ROLLBACK.
All of these commands function the same as in SQL*Plus. The following commands are specific to
PL/SQL Developer:
Command Meaning
BROWSE Object Select the Object in the Object Browser
EDIT Object Opens an editable window with the object’s definition
EDITD[ATA] Table | View Opens a SQL Window for the table or view with an editable
result set
EXPORT[DATA] Table Opens the Export Tool for the specified table
INFO Displays information about the connection
PROP[ERTIES] Object Displays a Property Window for the specified object
QUERY[DATA] Table | View Opens a SQL Window for the table or view with a read-only
result set
REC[OMPILE] Object Recompiles the object
SET COL[WIDTH] [Width] Determines the maximum column width in a result set. If
Width = 0, the width is unlimited. The default is 80.
SET EXEC[PAUSE] [ON | OFF] Pauses execution at the next command (ON), or continues
normally with the next command (OFF).
SQLPLUS Invokes SQL*Plus with the current file.
TEST ProgramUnit Opens a Test Window with a standard Test Script for the
specified program unit
VIEW Object Opens a read-only window with the object’s definition
Future releases of PL/SQL Developer will extend the functionality of the Command Window. Right
now the Command Window is well suited to execute scripts that automate specific tasks during the
PL/SQL Development process.
44 PL/SQL Developer 5.1 User’s Guide
Refresh – Retrieves the definition from the database again, discarding any changes you may have
made.
Close – Closes the editor window.
Help – Shows the online help.
Query – Invokes a SQL Window with a query that allows you to view and edit the table data.
View SQL – Displays a text editor with the SQL statements that have resulted from the changes
made in the editor.
The following chapters will describe the different pages of the table definition editor.
General page
The General page is displayed in the previous chapter, and contains the table owner and name, storage
information, cluster information, and comments. For a new table you can leave all properties empty,
except for the name. All other properties will get a default value:
Owner – the current user that is logged on.
Tablespace – the default tablespace for the current user.
%Free – 10
%Used – 40
Initial transaction entries – 1
Maximum transaction entries – 255
The default values of the segment properties (initial extent, next extent, %increase, minimum extents
and maximum extents) depend on the corresponding defaults of the tablespace.
The cluster information, storage information, and duration properties are mutually exclusive, because
the cluster implicitly defines the storage characteristics of the table, and temporary tables cannot be
clustered and also have implicit storage characteristics.
If you enter or select a cluster name, the storage properties and duration properties will become read-
only, and the cluster columns can be entered. Clearing the cluster name has the opposite effect.
If you define the table as temporary, the cluster and storage information will become read-only, and you
can define if rows are preserved after a commit.
If you define an index organization table, you must define a primary key. For a heap organized table
(the default) this is not a requirement.
If you are modifying an existing table, not all properties can be changed. The tablespace, initial extent,
minimum extents, cluster information, duration properties and organization properties cannot be
changed for a table that already exists in the database. If you want to change any of these properties,
you need to check the Recreate table option at the top of the window. As a result, the table will first be
dropped and recreated with the new definition. All data, triggers, and foreign key references will be lost,
so you should be careful when using this option!
46 PL/SQL Developer 5.1 User’s Guide
Columns page
On the Columns page you can view, add, delete, move, and modify the table’s columns. If you are
creating an object table, you can also select the object type on this page:
To add a column you can press the Insert column button, or you can start typing the new column
information on the last row (which will create a new, empty last row). The Type column has a
suggestion list for most common data types, but you can also use other data types here. The Default
column requires that you enter a value in the appropriate format, e.g. string values must be quoted.
To delete a column, press the Delete column button. This will either delete the column that currently has
the focus, or it will delete all selected columns. You can select one or more columns by clicking on the
row heading. Dragging the mouse will select a range of rows. Pressing the Control key while clicking
on a row heading allows you to select multiple individual rows.
To move one or more columns, select them as described in the previous paragraph. Now you can click
on one of the selected headings and move the selection to the desired location.
For existing tables, you cannot change the name of existing columns. You cannot delete such a column
either, unless you are using Oracle8i or later. To overcome these limitations, you need to check the
Recreate table option on the General page. The consequences of this option are described in the
previous chapter.
Note that changing the name of a column will automatically be propagated to the constraint columns,
index columns, and cluster columns.
If you select the type owner and type name at the top of this tab page, you will create an object table,
based on this object type. The column names and types are now defined by and restricted to the top-
level attributes of the object type. You can still define if a column is nullable, the default value, and a
comment. If you want to change the object type later, you must select the Recreate table option on the
General page.
PL/SQL Developer 5.1 User’s Guide 47
Keys page
On the Keys page you can view, add, delete, and modify the table’s primary, unique and foreign key
constraints:
This grid can be manipulated in the same way as the column grid in the previous chapter. You can add,
delete and modify the key constraints. Moving the constraints will not have any effect, as they are not
really ordered.
Note that the storage information of the underlying index that is used to enforce a primary or unique key
constraint is not defined on this page. If the constraint is enabled, there will automatically be a
corresponding index on the Indexes page with the same name. For this index you can define the storage
definition. Disabling or deleting a primary or unique key constraint will implicitly delete the underlying
index.
The Type column has a list that allows you to select just the Primary, Unique or Foreign key type. You
can quickly select the correct type by typing the first character (P, U or F). Note that a table can only
have one primary key constraint, and the default value for this column (Primary or Unique) depends on
this. Changing the type will affect the Referencing table, Referencing columns and Cascade columns, as
they are only valid for foreign key constraints. Changing the type to Foreign will also implicitly delete
the index.
48 PL/SQL Developer 5.1 User’s Guide
To define the Columns to which the constraint applies, you can simply type the column names in the
appropriate cell (separated by commas), or press the cell button. This will invoke a column selection
screen where you can easily add, remove or move (reorder) the key columns:
For foreign key constraints you can type or select a Referencing table. Doing so will automatically
select default Referencing columns, based on the primary and unique key constraints of this table. The
selection list for this column shows all column sets that make up primary or unique key constraints for
the referencing table, and are therefore the only candidates here. In the On Delete listbox you can define
what action should be performed for the records in the child table when the parent record is deleted. The
Set null action is supported in Oracle8i and later.
If you are using Oracle8, you can additionally define if the constraint is deferrable, and if it is initially
deferred. These 2 options are obviously related: you cannot have a non-deferrable constraint that is
initially deferred.
PL/SQL Developer 5.1 User’s Guide 49
Checks page
On the Checks page you can view, add, delete, and modify the table’s check constraints:
This grid can be manipulated in the same way as the column grid. You can add, delete and modify the
check constraints.
The Condition column should contain the boolean expression that must be true (or null) for all rows in
the table. You cannot apply a check constraint if one or more rows violate the condition, unless you also
uncheck the Enable option. The check constraint can be enabled after correcting the violating rows.
If you are using Oracle8, you can additionally define if the constraint is deferrable, and if it is initially
deferred. These 2 options are obviously related: you cannot have a non-deferrable constraint that is
initially deferred.
50 PL/SQL Developer 5.1 User’s Guide
Indexes page
On the Indexes page you can view, add, delete, and modify the table’s indexes:
This grid can be manipulated in the same way as the column grid. You can add, delete and modify the
indexes.
The Owner of the index can be left empty, the default owner is the user that is currently logged on. If
you want to use a different owner for the index, just select it from the list.
The Type of the index can be Normal, Unique, or Bitmap. The last index type is only available on
Oracle7.3 Servers and later. Note that you can only create a unique index if the index columns of each
row in the database are indeed unique. As long as this is not the case, you cannot apply this index to the
database.
To define the Columns that you want the table to be indexed by, you can simply type the column names
in the appropriate cell (separated by commas), or press the cell button. This will invoke a column
selection screen where you can easily add, remove or order the index columns.
For function based indexes you can specify the functions, separated by commas. For descending
indexes, you can follow the column name by DESC.
If the index is for a primary or unique key then the owner, name, type, and columns cannot be modified.
These properties are all derived from the key constraint. Changing the name of the key constraint will
automatically change the name of the corresponding index, changing the constraint columns will change
the corresponding columns for the index. The owner will always be the same as the owner of the table,
and the type of the index will always be unique.
PL/SQL Developer 5.1 User’s Guide 51
The Storage parameters can be defined or viewed by pressing the cell button. This will invoke a storage
editor:
For new indexes you do not need to enter any of this information, as each property has a default value:
Tablespace – the default tablespace for the current user.
%Free – 10
Initial transaction entries – 2
Maximum transaction entries – 255
The default values of the segment properties (initial extent, next extent, %increase, minimum extents
and maximum extents) depend on the corresponding defaults of the tablespace. The %Used property
does not apply to indexes.
Note that if you modify the %free, initial extent, and minimum extents properties of an existing index,
this will implicate that the index (and constraint) will be dropped and recreated to apply this change. For
large indexes, this may be time consuming.
52 PL/SQL Developer 5.1 User’s Guide
Privileges page
On the Privileges page you can grant/revoke privileges on the table to/from users and roles:
This grid can be manipulated in the same way as the column grid. You can add, delete and modify a
grantee. Deleting a grantee is equivalent to revoking all individual privileges.
The Grantee is the user or role to which you want to grant certain privileges. Note that privileges
granted to a role will often not suffice for the purpose of development of stored program units. If a user
is granted select privilege on a table through a role, and references this table in a stored program unit,
compilation will fail because the table is unknown. The user must personally be granted select privilege
if the object is to be used in a program unit that he or she owns.
The individual privilege columns can have 3 values:
(Blank) – The grantee does not have the privilege
Yes – The grantee has the privilege
Grantable – The grantee has the privilege, and can grant it to other users or roles
The Select, Insert, Update and Delete privileges allow the grantee to perform this action on the records
of the table. The References privilege allows the grantee to create a foreign key to this table. The Alter
privilege allows the grantee to alter the table definition with the alter table command. The Index
privilege allows the grantee to create an index on the table.
PL/SQL Developer 5.1 User’s Guide 53
You can save the SQL to a file, or copy it to the clipboard with the corresponding buttons at the upper
right corner of the window. The Print button on the toolbar will print the SQL. You can additionally
make changes to the SQL and apply the changed SQL. After applying the changed SQL, the window
will return to form mode and will refresh the table definition. Changes made to the SQL will
immediately be reflected in the forms.
If you press the View SQL button again, the window will return to form mode, discarding any unapplied
changes you may have made to the SQL.
If you selected the View option in the Object Browser to view the table definition, the View SQL button
will display the creation SQL for the table, without preceding it with a drop command. This way you
can save a table definition in a file, or copy its definition to another database or user.
54 PL/SQL Developer 5.1 User’s Guide
Most properties have a default value, and you only need to supply a name when creating a new
sequence:
Owner – The user that is currently logged on
Minimum value – 1
Maximum value – Unlimited
Initial value – 1
Increment by – 1
Cache size – 20
Cycle – Off
Order – Off
The default value for the Owner will be the user that is currently logged on. Checking the Public option
will create a public synonym, and will make the Owner field read-only. The Object owner and Object
name fields have a suggestion list to easily select a translation object for the synonym. If the Object
owner field is empty, the Object name list will display all objects.
PL/SQL Developer 5.1 User’s Guide 55
The default value for the Owner will be the user that is currently logged on, and you can use the
suggestion list to create a library with a different owner. The Filespec is the full file specification of the
3GL library that you want to use. If you are developing on the database server, then you can use the
Select DLL file button to select the dynamic link library. Otherwise you have to type the name of the
DLL (Windows NT or 2000) or shared object (UNIX). The validity of the Filespec is not checked.
If you are developing on the database server, then you can use the Select directory button to select the
directory path. The validity of the directory path is not checked.
56 PL/SQL Developer 5.1 User’s Guide
Creating a new job is equivalent to calling dbms_job.submit. Modifying an existing job is equivalent to
calling dbms_job.change. For more information about jobs, see the DBMS_JOB chapter in the Oracle
Supplied Packages Reference manual.
The Open PL/SQL Editor button next to the What field invokes a more convenient PL/SQL Editor with
syntax highlighting, Code Assistant, and so on.
Note that you need specific system privileges (such as provided by the DBA role) to view and modify
user information.
PL/SQL Developer 5.1 User’s Guide 57
General page
On the general page you basically only need to enter the name and password. All other properties have a
default value:
Default tablespace – SYSTEM
Temporary tablespace – SYSTEM
Profile – DEFAULT
Password expire – Off
Account Locked – Off
If you modify an existing user, the current password will not be displayed. Enter a new password to
change it, or leave it empty to leave the password unchanged. If the user is identified externally, you
cannot enter a password.
This page allows you to view and modify the object privileges granted to the user. This does not include
the privileges that are indirectly granted through a role.
In the first column you can see the object on which privileges are granted to the user. All other columns
represent a specific privilege. Each privilege can have the following value:
(Blank) – The user does not have the privilege
Yes – The user has the privilege
Grantable – The user has the privilege, and can grant it to other users or roles
58 PL/SQL Developer 5.1 User’s Guide
This page displays the roles that are granted to the user. Each role privilege can be grantable, so that the
user can grant it to other users and roles. If a role privilege is default, the role will be enabled when the
user logs on. If it is not default, the role privilege must explicitly be enabled for the session by executing
a set role command after the user has logged on.
This page displays the system privileges that are granted to the user. Each system privilege can be
grantable, so that the user can grant it to other users and roles.
PL/SQL Developer 5.1 User’s Guide 59
Quotas page
This page displays the tablespace quotas of the user. You can enter a maximum number of bytes,
kilobyes, or megabytes that the user can allocate in a tablespace, or you can specify that the quota is
unlimited.
By default a role does not need to be identified. You can also define password identification or external
identification for a role. Password identification requires that you enter a password, and is useful if the
role is not granted by default to users. Such a role needs to be explicitly set after a user logs on, which
requires the password.
The other 3 tab pages (Object privileges, Role privileges and System privileges) work in the same way
as the corresponding pages of the User definition function.
60 PL/SQL Developer 5.1 User’s Guide
Each limit can be set to Default, in which case the value will be inherited from the standard profile
DEFAULT, to Unlimited, or to a concrete value.
On the Users tab page you can define to which users this profile applies. Note that if you remove a user
from the profile, it will implicitly be changed to the DEFAULT profile.
Note that the Password and the Authenticated By properties will not be retrieved when you edit an
existing database link. You will have to enter this information every time you edit the database link.
PL/SQL Developer 5.1 User’s Guide 61
9. Reports
To run reports against your application data or against the Oracle dictionary, you can use PL/SQL
Developer’s built-in Report functionality. There are a number of standard reports, and you can easily
create your own custom reports. These custom reports can be saved in a report file, which can in turn be
included in the reports menu. This makes it very easy to run your own frequently used custom reports.
After entering the appropriate values and pressing the OK button, the report will be displayed:
The result is an HTML document that is displayed by PL/SQL Developer’s internal HTML viewer or
by the Internet Explorer ActiveX control, depending on the preferences (see chapter 13.1).
You can subsequently print the report by pressing the Print button on the toolbar, or you can save the
report in HTML format by pressing the Save results button on the right side of the Report Window. The
Copy as HTML button copies the report results to the clipboard. The Export Results button allows you
to export the results in CSV, TSV or XML format, or to export the results directly to Excel.
The Edit report button provides access to the report definition, if the report is not locked.
You can right-click on the results for additional options.
62 PL/SQL Developer 5.1 User’s Guide
In the SQL editor you can type a single SQL select statement for your report. For master/detail reports
you can use a join select statement (this will be described later). Let’s start simple with the well-known
emp table by typing the select statement and pressing the Execute button on the toolbar:
This is a very basic report, with only the default style properties applied. The following chapters
describe how you can refine the report’s functionality.
PL/SQL Developer 5.1 User’s Guide 63
9.3 Variables
Very often your reports will require some additional input before they can run. Let’s assume that you
want to restrict the report from the previous chapter to the employees of just one department. In that
case you need supply a substitution variable in the SQL text:
select * from emp
where deptno = &department
order by ename
When this report is run, the user is prompted for a department before the select statement is executed.
This is of course not very foolproof. What if the user enters nothing? The statement would lead to a
ORA-00936: missing expression exception. What if the user enters a value that is not a number? Or a
number that does not exist in the dept table? To prevent these situations, you can use the parameter
options described in the following chapters. These options must be specified between brackets, just like
attributes in an HTML or XML document.
Name option
The name of a variable is used as a prompt in the variable input form. Therefore you should make sure
that it describes the meaning of the variable. The name is the only option that does not have to be
specified between brackets, if it is the only option. If the name contains spaces or other special
characters, enclose it in double quotes. The following 2 examples are equivalent:
select * from emp
where deptno = &”Department number”
order by ename
and
select * from emp
where deptno = &<name=”Department number”>
order by ename
Hint option
Besides the name option, you can additionally specify a hint text. This hint will be displayed on the
status line of the variable input form when this variable has the focus:
select * from emp
where deptno = &<name=”Department number”
hint=”Only employees from this department will be listed”>
order by ename
Type option
The type option restricts the user to the information that can be entered, and also controls how the value
should be inserted into the resulting SQL text:
select * from emp
where deptno = &<name=”Department number”
type=”integer”>
order by ename
In this situation the user can only enter values that are valid integer values. The entered value will be
replaced in the SQL text as is. For strings however, you would want the value to be enclosed in quotes.
Consider the following select statement:
select * from emp
where ename = &<name=”Employee name”
type=”string”>
If you enter SCOTT (without quotes) in the variable input form, the resulting SQL would be:
select * from emp
where ename = ‘SCOTT’
64 PL/SQL Developer 5.1 User’s Guide
Valid types are: none, string, integer, float, and date. No validation will occur for date values, so that
the user can additionally supply date expressions like sysdate, trunc(sysdate, ‘MM’) and so on.
Required option
If you require a value for a certain variable, set its required option to “yes” or “true”:
select * from emp
where deptno = &<name=”Department number”
required=”yes”>
order by ename
Now the report can only be run if a value is specified for the department number.
Default option
To present a default value for the variable, specify the default option:
select * from emp
where deptno = &<name=”Department number”
default=”10”>
order by ename
The default value can also be a select statement. This select statement should return just one row with
one column. For example:
select * from emp
where deptno = &<name=”Department number”
default=”select min(deptno) from dept”>
order by ename
In this case the default value will be the smallest department number.
Ifempty option
As an alternative to making a variable required or providing a default value, you can specify the ifempty
value in case the user does not specify one:
select * from emp
where ename like &<name=”Employee name”
type=”string”
ifempty=”%”>
If the user does not specify a value, the percent sign will be used, and all employees will be retrieved.
This option cannot be specified together with the required option.
Uppercase option
If you have a string variable and want to implicitly convert its value to uppercase, set its uppercase
option to “yes” or “true”:
select * from emp
where ename = &<name=”Employee name”
type=”string”
uppercase=”yes”>
The value is displayed as typed, but is converted to uppercase in the resulting SQL text.
List option
The list option provides the user with a list of possible values. You can specify a comma-separated list
of items:
select * from emp
where deptno = &<name=”Department number”
list=”10, 20, 30, 40”>
order by ename
PL/SQL Developer 5.1 User’s Guide 65
This allows the user to select one of the four items, or to type a different value. In this case it makes
more sense to use a select statement though:
select * from emp
where deptno = &<name=”Department number”
list=”select deptno from dept order by deptno”>
order by ename
You can additionally provide a description for each item:
select * from emp
where deptno = &<name=”Department number”
list=”10, ACCOUNTING,
20, RESEARCH,
30, SALES,
40, OPERATIONS”
description=”yes”>
order by ename
Each item is now followed by a description, and the description option is added. The list will only
display the descriptions, but the actual value will be used in the resulting SQL text.
Again you can do the same with a select statement with 2 fields:
select * from emp
where deptno = &<name=”Department number”
list=”select deptno, dname from dept order by dname”
description=”yes”>
order by ename
To restrict the user to just the items in the list, specify the restricted option:
select * from emp
where deptno = &<name=”Department number”
list=”select deptno, dname from dept order by dname”
description=”yes”
restricted=”yes”>
order by ename
Now the user can only select values from the list, and cannot enter any other value by hand.
The items in a list can sometimes depend on the value of another variable. Imagine that you want to
create a report that shows all columns of a specific table. A table is identified by the owner and the
name. For the owner you can use a list of all users in the database. For the table name you can query the
all_tables view for the selected owner:
select * from all_tab_columns
where owner = &<name="Owner"
type="string"
list="select username from all_users order by username">
and table_name = &<name="Table"
type="string"
list="select table_name from all_tables
where owner = :owner
order by table_name">
order by column_id
As you can see, the select statement for the second (table) list refers to the first variable through the
:owner bind variable. Whenever the value of the owner is changed, the table list will be populated.
Note that the name of the bind variable cannot be longer than 30 characters, and cannot contain spaces
or other special characters. Spaces in the variable name will be converted to underscores. If the variable
name had been Owner of the table, then the bind variable would have been :owner_of_the_table.
Also note that if the value of a variable is empty, the dependant list will also be empty. No query will be
performed in this situation.
66 PL/SQL Developer 5.1 User’s Guide
Checkbox option
If the user can select one of two distinct possibilities, you can use the checkbox option. This option
needs to be followed by the checked and unchecked values:
select * from emp
order by hiredate &<name=”Descending sort order”
checkbox=”desc, asc”>
Even though you must always specify 2 values, one of the values can be empty:
select * from emp
order by hiredate &<name=”Descending sort order”
checkbox=”desc,”>
Since the default sort order is ascending, these 2 examples are equivalent.
Escape character
If you wish to use an ampersand in the SQL text that should not be interpreted as a substitution variable,
use a double ampersand instead. The following example will retrieve all employees from the ‘R&D’
department:
select * from emp
where emp.deptno in (select dept.deptno from dept
where dname = 'R&&D')
order by empno desc
If the text 'R&D' had been used instead, you would have been prompted for the D variable.
PL/SQL Developer 5.1 User’s Guide 67
As you can see, you can define various layout properties for all layout items (the report title, variables,
tables, and the fields). If you want to define properties for an individual field, you first need to press the
Refresh Fieldlist button on the toolbar:
Now all fields of the result set of the select statement will be included in the layout grid, and you can set
the layout properties of each individual field. If you leave the Style, Header or Align property of a field
empty, the corresponding property from the Default Field will be used.
68 PL/SQL Developer 5.1 User’s Guide
After changing a layout property, you can execute the report again to view the effect this has on the
results. You can alternatively enable the Auto Update option on the toolbar, in which case each change
will immediately be reflected in the results.
The following chapters describe the various layout properties in detail.
Displayed
The checkbox in the leftmost column of the layout grid indicates if the layout item should be displayed
or not. This allows you to suppress the report title or variables, and allows you to control whether a
specific field should be displayed or not.
Description
The description of the Report Title will be displayed at the top of the report and after each page break.
The description of the Variables will be displayed above the variables.
For the individual fields you can define a description to override the standard field name. This
description will be used for the header of the column.
Style
The style controls the appearance of the layout items. Press the cell button (...) to bring up the style
editor:
In the listbox at the top of the style editor you can see all
standard styles, and a Custom style. You can select a
standard style from the Style Library (see chapter 9.5), or
you can select the custom style so that you can change the
various style properties for the current layout item.
Note that this style system is based on the Cascading Style
Sheets (CSS) standard. The properties that you see in the
style editor are the ones that you will most frequently use,
but you can also add other CSS properties and values
below the standard properties. You can, for example, add a
Height style property with a value of 20pt to set the cell
height to 20 points. See http://www.w3.org/TR/REC-CSS2
for more information about Cascading Style Sheets.
The Copy and Paste buttons allow you to copy the
properties of a style, so that you quickly derive a new style
from an existing one.
If you define nothing for the field styles, the Default Field
style from the Style Library will be used. You can override
this by defining the style of the Default Field layout item.
You can override this default style at the field level by
specifying the corresponding style. Note that each field
header inherits its style properties from the Default Header
style, so you only need to override the properties that you want to change. If, for example, you define
the Default Field style as Verdana, 14 points, blue, and you want to display the EMPNO column in
Verdana, 14 points, red, you only need to define the color at the EMPNO level. The font family and font
size will automatically be inherited from the Default Field level.
The default styles of the various layout item types are described in chapter 9.5.
PL/SQL Developer 5.1 User’s Guide 69
Header
Just like you can set the style for the data of the individual fields, you can also set the style for their
headers. If you define nothing, the Default Field Header style from the Style Library will be used. You
can override this by defining the style of the Default Header layout item. You can override this default
style at the field level by specifying the corresponding header style. Note that each field header inherits
its style properties from the Default Header style, so you only need to override the properties that you
want to change.
Align
You can align the layout items in the following ways:
Left – The item will be left-aligned within its cell
Right – The item will be right-aligned within its cell
Center – The item will be centered within its cell
Default – Numbers will be right-aligned, all other items will be left-aligned
None – No alignment will be specified
Note that you can also set the Text Alignment style property for a layout item. This will take precedence
over the alignment option you can specify in the layout grid. Also note that the effect of the alignment
may depend on the Width style property of the layout item.
Format
By default the format of a field is controlled by the data type, scale, and precision. Very often you will
use calculated fields or aggregated fields, in which case the scale and precision are unknown. In these
situations you can specify a format.
The Format property only has effect for date and number fields. For number fields you can use a 9 for a
zero-suppressed digit, 0 for a normal digit, G for a thousand separator, D for a decimal separator, and E
for scientific notation. You can additionally specify literal text in double or single quotes. Some
examples:
For date fields you can use the standard Windows date and time formats.
70 PL/SQL Developer 5.1 User’s Guide
Break
The break layout property allows you to structure your report results. Assume that you want to display
the departments and their employees. You can specify the following query for this:
select d.*, e.*
from emp e, dept d
where e.deptno = d.deptno
order by d.deptno, e.empno
This would of course lead to a simple tabular report:
By specifying a Break on the LOC column, you will get some more structure into your report:
Repeating values for the fields up to (and including) LOC will be suppressed. In short: each dept record
will only be displayed once. In this case it is necessary that the records are sorted by department (the
DEPTNO column). If you want to repeat the header after each break, use the Break + Header option.
PL/SQL Developer 5.1 User’s Guide 71
You can have multiple breaks for a report. The order by clause of the query must assure that the result
set is sorted on all break columns.
Sum
The sum property allows you include a sum for a field:
You can specify that the sum is to be calculated at the break level, at the report level, or both.
72 PL/SQL Developer 5.1 User’s Guide
Page headers
To define a page header, you first need to set the page size (see chapter 9.6). The Report Title will be
repeated after each page break, and can include the following variables:
OSUser – The Operating System user.
DBUser – The user that is connected to the database.
Database – The database that the user is connected to.
Date – The current date.
Time – The current time.
Page – The current page.
To include such a variable in the page header, precede it with an ampersand. For example:
If you run the report connected as user scott to database chicago, the header will look as follows:
Since the report is formatted as HTML, you can additionally include HTML code. To include an image,
you could include the <img> tag:
To include left aligned, centered, and right-aligned information, you can use a single-row table with 3
cells, and include the information in the corresponding cell:
Note that you can use these variables and HTML code in the description of all layout items, but they are
most useful for the Report Title.
PL/SQL Developer 5.1 User’s Guide 73
9.6 Options
You can specify various options for your report:
Connect Parameters
The Connect Parameters determine how the report query will be run. If, for example, it is necessary that
your report is executed under the SYS account, you can enter this name in the Username field. You can
additionally enter the Password, or you can leave it empty. If you leave it empty, you will be prompted
for the password when the report is executed. You can also specify the Database, if the report should
74 PL/SQL Developer 5.1 User’s Guide
always be executed in the same database instance. You can alternatively enter * in the database field,
which indicates that the report should be executed in the current database.
The Use this connection option allows you to disable or enable the Connect Parameters for a report. If it
is disabled, the current PL/SQL Developer connection will be used.
Security
The Security options allow you to lock the report definition (the SQL, Layout, and Options), so that a
user cannot view or change it. This may be useful if the Connect Parameters specify a privileged
account (such as SYS) with password. If a user can change the SQL, he or she could execute any
statement under the SYS account if the report is not locked.
The Security can be set to one of the following values:
Unlocked – Anybody can change the report definition.
Locked for other users – You can only change the report definition if you know the report’s
Password, or if you are connected in PL/SQL Developer with the same account as specified in the
Connect Parameters.
Locked for all users – You are always prompted for the report’s Password before you can change
the report definition, regardless how you are currently connected in PL/SQL Developer.
If the report is locked, the report file (.rep) is encrypted so that is cannot be viewed or changed with a
text editor.
Layout options
Form layout – By default all records are displayed in tabular layout, except for master records,
which are displayed in form layout. By enabling this option, all records will be displayed in form
layout. This may be useful if each record has many and/or wide fields, that cannot be displayed on
a single line.
Left margin – The number of pixels for the left margin of the report. This option only works if you
are using the Internet Explorer as HTML viewer.
Top margin – The number of pixels for the top margin of the report. This option only works if you
are using the Internet Explorer as HTML viewer.
Page break – The number of lines after which a page break should occur. The report header will
be repeated after each page break.
Only NBSP – When enabled, all spaces in the data will be converted to NBSP’s (non-breaking
spaces) in the HTML output. When disabled, normal spaces will be used. This can affect the
layout, because HTML viewers will display consecutive spaces as one space.
Include SQL – When enabled, the SQL text of the report is included in the HTML output.
Other options
Background image – The image (.jpg or .gif) that should be displayed in the background of this
report. You can use the Select file button to find your image file.
Background color – The color that should be displayed in the background of this report.
PL/SQL Developer 5.1 User’s Guide 75
The Default Report directory option indicates whether the Reports menu should include the Reports
subdirectory from PL/SQL Developer installation directory. This directory contains the standard
reports. The edit field below this option contains a list of directories that should be included. You can
type directories manually, or you can select a directory by pressing the Add directory to list button on
the right.
Note that the report files and subdirectories will be merged in the Reports menu. You should try to
prevent duplicate subdirectory and report filenames within this directory list, otherwise you will get
ambiguous menu items in the Report menu.
The Style Library is also accessible from within this report configuration dialog (see chapter 9.5).
76 PL/SQL Developer 5.1 User’s Guide
10. Projects
To organize your work you can use PL/SQL Developer’s built-in project concept. A project consists of
a collection of source files, database objects, notes, and options. It allows you to work within the scope
of a specific set of items, instead of a complete database or schema. This makes it easy to find the
project items you need, to compile all project items, or to move a project from one location or database
to another.
A project keeps track of your desktop configuration. If you reopen a project, all items that were opened
when the project was previously closed will be opened at the same position. The AutoSave Desktop
preference must be enabled for this. This information is not stored in the project definition file
(Project.prj), but in the project desktop file (Project.dsk)
Note: to work with projects, the Use Projects preference must be enabled. If this is not the case, the
main menu will not contain the Project item. For all project menu items there are also corresponding
toolbar buttons, which can be added to the toolbar through the Toolbar preference page (see chapter
13.1).
On the General page you can define how you want to connect when this project is opened. You can also
define if you want to continue project compilation after a compilation error has occurred.
The Items page allows you to view the project items. This can be source files of PL/SQL program units,
Test Scripts, SQL Scripts, Reports, and so on. A project item can also be an object that is stored in the
database, and that does not have a representation in a source file. When the project is created, the item
list will obviously be empty.
The Notes page allows you to maintain project notes. These notes can contain anything, such as a to-do
list, project decisions, design, and so on.
the options, and the notes. Therefore you need to save a project whenever you add or remove an item,
when you change an option, or when you change the notes.
Saving a project will not implicitly save the source files that are included in the project.
The first 4 Program Files are enabled for compilation. The 2 Test Scripts, the Report File, and the tables
and sequences are not enabled for compilation.
78 PL/SQL Developer 5.1 User’s Guide
You can keep the Project Items Window open at all times to have quick and easy access to all project
items. This window is part of the project desktop, and will implicitly be reopened when the project is
reopened.
To edit an item, you can simply double-click on it. If the item is a source file, it will be opened in a
corresponding window (Program Window, Test Window, and so on). If the item is a database object,
the appropriate editor will opened with the object definition.
You can alternatively right-click on an item to bring up the popup menu as displayed above. Here you
can disable/enable the item for compilation, or you can remove the item from the project. If the item is a
database object, you will also have access to the object popup menu for that object as a submenu.
To change the order of the project items, you can click on the row header and drag it to the new
location. The order is not only visually important, but also determines the order of compilation.
The Make function will only compile those items that have been changed since the previous
compilation. If a PL/SQL Program Unit is included as a database object, and it is invalid in the
database, it will also be recompiled. The timestamp of the compilation is stored in the project’s desktop
file. Items that are enabled for compilation but are up-to-date, will be listed as Skipped in the
compilation progress window.
PL/SQL Developer 5.1 User’s Guide 79
By pressing the right mouse button on an object icon, a context sensitive popup menu appears that
allows you to perform other functions on this object. The functions from this popup menu are described
in the following paragraphs.
You can select multiple objects by using the Control or Shift key during selection. If multiple objects
are selected, the object popup menu will show only those items that are applicable to all selected
objects, and the drag and drop function will work on all objects simultaneously.
The Browser preferences (see chapter 13.1) allow you to define which folders are visible, and in which
order they are displayed. It also allows you to define the maximum number of objects that can be visible
in the Recent objects folder. Furthermore you can define the double-click action for a browser object.
By default this will expand the corresponding node, but you can also define that this will bring up the
object definition editor, or the properties window.
Duplicate an object
You can duplicate a table, sequence or synonym by selecting the Duplicate item from the popup menu.
This will invoke an editor window with all properties of the selected object, except for the name. This
can be useful if you want to create a similar table to perform some tests on.
The properties are displayed in a modal window that you can place anywhere on the screen. You can
keep a property window visible (it will stay on top of other windows) and continue editing in another
window. You can additionally roll-up and roll-down the window by pressing the button on the upper-
right of the window. This way you can easily make space for other things, and keep the properties
available.
You can select rows, columns or ranges of cells in a description window. To select rows or columns,
just click on the row heading or column heading and drag the mouse pointer to highlight the selection.
To select a specific range of cells, move the mouse pointer over the left edge of a cell until its shape
changes, press the mouse button, and drag the mouse to highlight the selection. The selection can be
copied or printed. To make a comma delimited copy of the selected cells, right-click on the window and
select the corresponding item from the popup menu. To export the description to a CSV, TSV, HTML
or XML-file, select the corresponding item from the Export submenu. To print the contents of a
description window, select the Print item.
By double-clicking on a cell in a description window, the contents of the cell will be copied into the
editor of the topmost window.
To sort the rows in a description window, press the heading button of the column on which you want
the rows to be sorted.
Renaming an object
Tables, views, sequences and synonyms can be renamed by selecting the Rename item from the popup
menu. A dialog will appear with the old name, which you can modify and apply.
Dropping an object
Sometimes it is necessary to drop an object. It may have become obsolete, or must be changed from one
type to another (e.g. from a function to a procedure). To accomplish this, just select the Drop item from
the popup menu.
Recompiling an object
Objects often reference other objects in the database. Whenever these referenced objects change, the
referencing object can become invalid. In this case a red mark is displayed in the icon of this object. To
recompile an invalid object, select the Recompile item from the popup menu. If compilation succeeds,
the mark disappears. If compilation fails, you can view the errors by selecting the View item from the
popup menu.
output parameters and function results after executing the Test Script. From the Browser you can select
the Test item to create such a Test Script.
Exporting tables
To export the definition and data of a table, select the Export data item. This will bring up the Export
Tables tool for the selected table. See chapter 13.5 for details.
Running a job
For jobs, submitted through the dbms_job package, you can explicitly run it by selecting the Run item
from the popup menu.
PL/SQL Developer 5.1 User’s Guide 85
Order by clause.
Use the previously mentioned columns from the all_objects view to order the objects in the
Browser.
PL/SQL Developer 5.1 User’s Guide 87
13. Tools
Several tools are available in the Tools menu. These tools are described in this chapter.
13.1 Preferences
The Preferences tool allows you to set various preferences for PL/SQL Developer. When you select this
item, the following dialog appears:
Options
Autosave username.
This option can be checked to automatically save the username of each PL/SQL Developer
session. When you re-start PL/SQL Developer later, the last username will be default in the logon
dialog.
Allow editing of database source.
This option controls if the source of a program unit or view can be edited directly from the Object
Browser, or that it requires that it opened from the file system.
Ask to save edited database source.
If you edit a program unit from the source that is stored in the database dictionary (by right-
clicking on the program unit and selecting Edit from the popup menu), you can prevent that you
are asked to save these modifications to a file by disabling this option. If you have edited a
program unit that was previously opened from the file system, you will always be asked to save
these changes.
Allow compilation of read-only source files.
If a source file is read-only, it can not be compiled when loaded into a Program Unit Window.
This preference is useful when using a Version Control System, which often leave a read-only
copy of a source file in a working directory. Such a copy must not be compiled, as this might
interfere with the work of other project members.
AutoCommit Test Window.
This option controls if executed Test Scripts are automatically committed.
Automatic statistics.
This option controls if a statistic report is to be generated for every executed SQL Statement and
Test Script. If you disable this option, the statistic report will be empty. By pressing the Select...
88 PL/SQL Developer 5.1 User’s Guide
button, a list opens up with all statistics available in the database that you are currently connected
to. You can select which statistic you wish to include in a statistic report. If you do not have
access to the dynamic performance tables, the Select... button will be disabled.
Use DBA views if available.
PL/SQL Developer will try to use the DBA views (dba_objects, dba_triggers, and so on) instead
of the ALL views (all_objects, all_triggers, and so on) if this preference is set. The DBA views
might expose more information than the ALL views if a developer has certain system privileges.
AutoSave Desktop.
When this option is enabled, all files that were opened when you stop PL/SQL Developer will
automatically be reopened when it is started again. A currently opened Command Window or
Explain Plan Window, which are not associated with a file, will also be restored. Furthermore, the
dimensions of the main window and Object Browser will be restored.
Confirm Commit & Rollback.
Whenever you commit or rollback a transaction by pressing the corresponding buttons, you will
be asked for confirmation. Disabling this option will immediately commit or rollback without this
confirmation.
Use internal HTML viewer for HTML Help.
By default PL/SQL Developer will use an internal HTML viewer to display the HTML help
documentation. If you have Microsoft Internet Explorer 4 or later, you can disable this option and
use Microsoft’s HTML components instead. This will give you some extra features in the popup
menu, and will inherit preferences made in Internet Explorer.
HTML Help window: “Stay On Top”.
If the option is enabled, the HTML Help window will stay on top until you close or minimize it. If
it is disabled, the HTML Help window will appear as a separate task, with its own button on the
Windows task bar. This way you can bring PL/SQL Developer main window or the Help window
to the front whenever you need it.
Use Multi-row Tabs.
If a window contains multiple tab pages, this preference controls whether these tab pages can be
divided over multiple rows in case of an overflow. If this option is disabled, 2 scroll buttons will
appear in case of a tab overflow situation. This currently only applies to the Program Window.
Use complete path in window titles.
By default, only the filename is displayed in a window title. If this option is enabled, the complete
path will be displayed.
Session mode.
Controls how many separate database sessions PL/SQL Developer will use. This feature is
described in detail in chapter 11.
Logoff with open transaction.
When a session is logged off and this session has an open transaction, the default action is to
commit that transaction. Through this preference you can define that such an open transaction is
rolled back, or that you will be asked for confirmation.
Check Connection.
When this option is enabled, PL/SQL Developer checks every 60 seconds if your database
connection is still alive. If your session is killed or the server is shutdown, PL/SQL Developer will
automatically logoff.
Oracle Home.
By default PL/SQL Developer will use the Primary Oracle Home on your PC. You can define the
PL/SQL Developer 5.1 User’s Guide 89
Primary Oracle Home with the Oracle Home Selector (a standard Oracle utility). You can force
PL/SQL Developer to use a specific Oracle Home by selecting one from this list.
OCI Library.
PL/SQL Developer will use the most recent version of SQL*Net or Net8 that is installed. If this
version of SQL*Net or Net8 causes problems, you can force PL/SQL Developer to use another
version. The DLL name will be something like ora72.dll (SQL*Net 2.2), ora73.dll (SQL*Net 2.3),
oci.dll (Net8 8.1.x), and so on. These DLL's are located in Oracle's bin directory.
Force OCI7 mode on OCI8.
Some releases of Net8 (8.0.3 and 8.0.4) have some bugs that might cause problems in PL/SQL
Developer. Setting this preference will cause the more solid SQL*Net 2 functions of Net8 to be
used instead. One example of a Net8 bug is that it reports incorrect parameter modes when
describing procedures and functions. Disadvantage of this preference setting is that you can't
query BLOB, CLOB and BFILE columns and that wrapped packages cannot be described.
Use Projects.
The Project main menu item will only be visible if this option is enabled. Disable it if you are not
using projects, so that it does not take up any space in the main menu. For more details about
projects, see chapter 10.
Editor
Automatic indent.
Determines if the editor will automatically indent after pressing the enter key.
Indent step.
The number of characters that the editor will indent when indenting or unindenting a selection.
Smart tab.
Will cause the editor to tab to a position relative to the previous line.
Tab size.
Determines the number of characters that a tab will use.
Smart fill.
The editor will replace spaces by tabs if possible.
Use tab character.
When disabled, only spaces will be used for tabs and indents.
Wrap lines.
Lines that are wider than the window width will be continued on the next line.
90 PL/SQL Developer 5.1 User’s Guide
Code Assistant
The Code Assistant automatically displays information about database objects as you type their name
(see chapter 14.3). This preference page allows you to define the behavior of this feature.
Automatically activated.
The Code Assistant can automatically be invoked after a certain delay (see below). You can also
choose to manually activate the Code Assistant through a function key.
Delay.
The number of milliseconds that the editor will wait before it displays the Code Assistant List.
Coding Style.
Controls how selected items are inserted into the editor when you select them:
Smart – The Code Assistant will look at the described object to determine the style.
Init Caps – The first character of each word (separated by an underscore) in capitalized.
Lowercase – All characters are converted to lowercase.
PL/SQL Developer 5.1 User’s Guide 91
Browser
These preferences control the appearance and behavior of the Object Browser (see chapter 12).
Folders.
Controls which folders are visible, and in which order. If you press the Reset to Default button, the
folders will be reset to the default settings.
Maximum Recent objects.
Controls how many objects will be visible in the Recent objects folder. The least recently used
object will be removed when more than this number of objects would be displayed.
Double-click action.
Controls which action will be performed when you double-click on an object in the browser. The
default action is to expand or collapse the item, but you can also define that a window is opened to
92 PL/SQL Developer 5.1 User’s Guide
view or edit the object definition, or to view its properties. You can additionally define that both
the spec and body are viewed or edited in case of a package or type.
Drag & Drop action.
Controls which action will be performed when you drag and drop an object into the workspace.
The default action is to view the item, but you can also define that a window is opened to edit the
object definition, or to view its properties. You can additionally define that both the spec and body
are viewed or edited in case of a package or type.
Show data types.
When this option is enabled, the data types of columns (tables and views), attributes (objects) and
parameters (functions and procedures) will be displayed in the browser.
Smooth Refresh.
On some systems this option may slow down the Browser’s refresh operation (e.g. changing the
Browser Filter, logging on as a different user, and so on). If this is the case you should disable it,
though this may lead to some screen flickering when the Browser is refreshed.
Confirm Recompile.
When this preference is enabled, recompiling a program unit in the Object Browser will result in a
success or failure message. When it is disabled, you will only see a message when compilation
fails.
Fonts
The Fonts preferences control the browser font, editor font and the font used in the various grids like in
the SQL window, the property windows, and so on. By pressing the Select button you can change the
name, style and color of the font.
PL/SQL Developer 5.1 User’s Guide 93
Printing
Output
Enabled.
In SQL Windows and Test Windows, calls to dbms_output.put_line will be buffered and displayed
after execution of the script. This preference can be overruled on the output page of each
individual SQL Window and Test Window.
Clear before execute.
Before executing a SQL Window or Test Window, the current output page will be cleared. This
way, the output page will always contain just the output of the last execution.
Buffer size.
The size in bytes of the dbms_output buffer. If more than this number of bytes is output during
one execution, an exception will occur.
Debugger
Profiler
These preferences control the Profiler page of the Test Window (see chapter 5.3).
Columns.
Controls which columns from the profile table should be displayed, and in which order.
Time units.
Defines the unit of the Total time, Maximum time, Minimum time and Average time columns.
Show 0 Occurrences.
Determines if a reported source line with 0 execution occurrences will be displayed.
Graphical time display.
The Total time column will display a graphical representation of the relative time. You can control
the brightness of the color of this bar, or make it invisible.
96 PL/SQL Developer 5.1 User’s Guide
Trace
These preferences control the Trace page of the Test Window (see chapter 4.11).
You can control which columns from the trace table should be displayed, and in which order.
File extensions
On this page you can define the default extensions of all file types. When saving or loading such a file,
the default extension is assumed if you do not specify an extension in the file dialog. For each file type
you can additionally specify 'other' extensions, which will be displayed in the file dialogs as well.
Separate multiple extensions with a comma.
By pressing the Register Filetypes button you can associate these default extensions with PL/SQL
Developer. Double-clicking a file with such an extension in the Windows Explorer will automatically
launch PL/SQL Developer. A dialog will appear that allows you to select which extensions you want to
associate with PL/SQL Developer.
PL/SQL Developer 5.1 User’s Guide 97
Key configuration
On this page you can define your own key configuration for all functions in PL/SQL Developer. Just
select the function in the list, navigate to the Hotkey edit, and press the key combination that you want
to use for this function. To clear a hotkey for a specific function, select it from the list and press the
Clear button.
Directories
On this page you can define what directories you want to use for various file types that are used in
PL/SQL Developer.
Program files
Defines the starting directory when opening or saving Program files. If you leave this directory
blank, you will always start in the directory you opened or saved a Program file the last time.
Test scripts
Defines the starting directory when opening or saving Test scripts. If you leave this directory
blank, you will always start in the directory you opened or saved a Test script the last time.
SQL Scripts
Defines the starting directory when opening or saving SQL scripts. If you leave this directory
blank, you will always start in the directory you opened or saved a SQL script the last time.
Report files
Defines the starting directory when opening or saving Report files. If you leave this directory
blank, you will always start in the directory you opened or saved a Report file the last time.
98 PL/SQL Developer 5.1 User’s Guide
Command files
When open a command file from the menu or by typing @file, this directory will be used by
default. If you leave this directory blank, the working directory will be used.
Macros
This directory will be used to store your macro library. If you leave this directory blank, the
Macro subdirectory in the PL/SQL Directory will be used.
Templates
This directory will be used to store program file templates. If you leave this directory blank, the
Template subdirectory in the PL/SQL Directory will be used.
Plug-Ins
This directory will be used to search for Plug-Ins. If you leave this directory blank, the PlugIn
subdirectory in the PL/SQL Directory will be used.
Projects
Defines the starting directory when opening or saving Projects. If you leave this directory blank,
you will always start in the directory you opened or saved a Project the last time.
Date/Time
On this page you can define the date and time formats that will be used in PL/SQL Developer.
Program Window
These preferences affect the behavior of the Program Window (see chapter 3).
SQL Window
These preferences affect the behavior of the SQL Window (see chapter 6).
AutoCommit SQL.
This option controls if DML statements executed in a SQL Window are automatically committed.
AutoCommit posted records.
This options controls if records posted through the result grid are automatically committed.
AutoExecute queries.
If this option is enabled, a SQL Window that is created when selecting Query Data or Edit Data
for a Table or View object will immediately be executed. If this option is disabled, you can
modify the generated select statement before executing it.
100 PL/SQL Developer 5.1 User’s Guide
AutoSelect Statement.
If you have more than 1 SQL statement in the SQL Editor (separated by semi-colons), the SQL
Window will automatically select the statement where the cursor is currently located before
execution. This way you don’t have to explicitly select the statement yourself.
Ask to Save New Windows.
When you close a SQL Window that was just created, you will normally be asked if you want to
save it to a file. If you disable this option, this confirmation will be omitted. If you have modified
a previously opened SQL file, you will always be asked to save these changes, regardless of this
preference.
Linked Query in New Window.
When this preference is set, executing a linked query (see chapter 6.4) will create a new SQL
Window. If it is not set, the linked query will be executed in the current SQL Window.
Number fields to_char.
When this preference is enabled, number fields will be converted to character values on the server.
The NLS parameters of the session will determine the format of the values. PL/SQL Developer
will not perform any additional number formatting or validation.
Date fields to_char.
When this preference is enabled, date fields will be converted to character values on the server.
The NLS parameters of the session will determine the format of the values. PL/SQL Developer
will not perform any additional date formatting or validation, and the date picker will not be
available when editing date fields.
Records per page.
This preference determines how many records are initially retrieved for a select statement, and
each time you press the Next Page button in the result grid of a SQL Window:
Automatically determined – The size of the result grid determines how many records are
retrieved.
Fixed – The number of records specified are retrieved.
All records – All records are immediately retrieved when the query is executed.
Number layout.
This preference controls how number columns are displayed:
Left aligned – Values are displayed left aligned, without any formatting.
Right aligned – Values are displayed right aligned, without any formatting.
Formatted – Values are displayed right aligned, with a format that corresponds to the
precision and scale of the field.
Query By Example.
These preferences control the default behavior of the SQL Window during QBE mode (see
chapter 6.3):
Case insensitive – Query values of character fields are treated case insensitive.
Automatic Contains – Character fields only need to contain the query values.
Ignore Time fraction – The time fraction of date fields is ignored if the query value does not
contain a time fraction.
PL/SQL Developer 5.1 User’s Guide 101
Plan Window
These preferences control which columns of the plan table should be displayed in the Plan Window (see
chapter 5.1), and in which order they should appear.
Toolbar
These preferences control the appearance of the main toolbar.
You can control which buttons should be visible, and in which order. Use the Separator item to separate
groups of related buttons. The New Bar item can be used to create a new toolbar below the previous
toolbar.
The Reset to Default button resets the toolbar to its default state. The Reset to Classic button resets the
toolbar to the PL/SQL Developer 3 layout. Use the Button spacing value to control the spacing between
each button.
102 PL/SQL Developer 5.1 User’s Guide
Appearance
This preference page allows you to customize some general appearance aspects of PL/SQL Developer:
Background Gradient.
Allows you to define the color and gradient of PL/SQL Developer’s workspace. If you do not
want to use a gradient, but just a single color, set Color 1 and Color 2 to the same value.
Faded disabled buttons.
When enabled, disabled buttons are displayed with faded colors. When disabled, the standard
grayed out appearance is used for disabled buttons. For 256 color displays, disabled buttons are
always grayed out.
Language.
If you have a multi-language version of PL/SQL Developer, you can select a language here. All
captions and messages will subsequently be displayed in that language.
Connection Indicators.
These options allow you to provide some visual indication when PL/SQL Developer is using
specific connections. You can define a number of connection matches in user@database format,
and associate a color with it. This color can subsequently be associated with a left or right aligned
toolbar indicator, the editor background, or with the application background (overriding the
background gradient).
A connection match can contain the * and ? wildcard characters. In the example above, the editor
background and right aligned toolbar indicator will be red when connected to the PRODDB
database with any user. It will be yellow when connected as SYS to any database. The first item in
the list will take precedence, so the indicators will be red when connected as SYS to the PRODDB
database.
HTML/XML
These preferences allow you to control the HTML and XML output that is generated by the Report
Window and the Export functions:
PL/SQL Developer 5.1 User’s Guide 103
Charset encoding.
Allows you to define the character set encoding of the HTML or XML document. This should
correspond to the character set of your Oracle environment, so that the data is interpreted
correctly.
Heading.
This text will be inserted into the <HEAD> section of an HTML file, or into the standard XML
header of an XML file.
Backup
This preference page contains options for backup and recovery of your source files.
13.2 Browser
The Browser tool is described in detail in chapter 12. In the Tools menu, you can show or hide the
browser by selecting the Browser item. You can also define Browser Filters from this menu, which are
also described in chapter 12.
Note that the currently active Browser Filter controls the objects that are searched.
Searching is performed in the background. You can continue doing other work, or select an object in the
search results to view its source, and so on.
If you right-click on the search results you will see the popup menu of an object. The first item in this
popup menu is Locate text, which opens the source in a Program Window, and will immediately take
you to the first occurrence of the search text.
PL/SQL Developer 5.1 User’s Guide 105
Note that the currently active Browser Filter controls the invalid objects that are included. The bottom
section of the dialog will display any compilation errors that have previously occurred for the currently
selected object.
To recompile the objects, press the Execute button on the toolbar. The dependencies of the objects will
be analyzed to determine in which order compilation should occur. The icons at the left of the object list
will indicate which objects were successfully compiled. The compilation error section will be updated
after compilation is completed.
In the object list you can right-click on an object to view its source or to open the object in the Browser.
106 PL/SQL Developer 5.1 User’s Guide
The export function analyzes the foreign key dependencies that may exist between the tables, and places
the tables in the correct order in the output file.
This export method creates a standard SQL script with insert statements and (optionally) DDL
statements to recreate the table definition. The tab page contains the following options:
Drop tables – The generated SQL script contains statements to drop the tables before they are
recreated and loaded. The Create tables, Truncate tables, and Delete records options are disabled
in this situation, and have an implicit value.
Create tables – The generated SQL script contains statements to create the tables before they are
loaded. This includes constraints, indexes and grants.
Truncate tables – The generated SQL script uses truncate table statements to empty the tables
before they are loaded. This option is faster than the Delete tables, but cannot be used if foreign
key constraints exist.
Delete tables – The generated SQL script uses delete statements to empty the tables before they
are loaded.
Disable triggers – The generated SQL script disables all triggers of the tables before they are
loaded, and enables them afterwards. This can improve performance, and can sometimes be
necessary if the triggers contain checks that are not applicable to the import process.
Disable foreign key constraints – The generated SQL script disables all foreign keys of the tables
before they are loaded, and enables them afterwards. This can be necessary for self-referencing
foreign keys. Foreign keys between different tables will not lead to conflicts, because the tables
are exported in a correct order. Disabling foreign keys can also improve performance.
Commit every – Controls how many records will be inserted in the generated SQL script before a
commit is executed. If this value is zero, all inserts will be committed at once at the end of the
SQL script. For large export files and small rollback segments it will be necessary to supply an
appropriate value here.
Where clause – Only records that match the where clause will be exported. The where clause must
be applicable to all selected tables!
Advantages of this method are the portability of the SQL script, and the possibility to edit the results
with a text editor.
This export method creates a custom, compressed PL/SQL Developer export file with the table
definitions and data. The tab page contains the following options:
Where clause – Only records that match the where clause will be exported. The where clause must
be applicable to all selected tables!
Compress file – Disabling this option will disable the compression. This can lead to improved
performance if the data cannot be very well compressed (e.g. for long raw or BLOB data that is
already compressed in the database).
108 PL/SQL Developer 5.1 User’s Guide
Advantages of this method are the greatly reduced file sizes of the export files, the fact that all options
are deferred to the import phase, and that you can easily select tables during import.
This method uses a dump file created by the Oracle export utility, and launches Oracle’s import utility
to import the data. You can specify various options, each corresponding to a command line option of the
import utility (see the “Oracle Server Utilities” guide). The Import Executable field allows you to
select a specific version of Oracle’s import utility. By default the most recent version from the current
Oracle Home will be used.
After the import is finished, a new Log tab page will be visible. This page contains the logging that was
created by the import utility.
PL/SQL Developer 5.1 User’s Guide 109
This method executes the SQL script that was generated by the Export Tables tool. You can choose to
launch SQL*Plus to run the script, or use an internal Command Window. For the SQL*Plus alternative
you can select a specific SQL*Plus executable. By default the version from the current Oracle Home
will be used.
After selecting an import file that was previously exported using the PL/SQL Developer method, you
can select to import one or more files from the list. The following options can be specified:
Drop tables – Drop the tables before they are recreated and loaded. The Create tables, Truncate
tables, and Delete records options are disabled in this situation, and have an implicit value.
Create tables – Create the table before it is loaded. This includes constraints, indexes and grants.
Truncate tables – Truncate the tables before they are loaded. This option is faster than the Delete
tables, but cannot be used if foreign key constraints exist.
110 PL/SQL Developer 5.1 User’s Guide
Delete tables – Delete all records in the tables before they are loaded.
Disable triggers – Disables all triggers of the tables before they are loaded, and enable them
afterwards. This can improve performance, and can sometimes be necessary if the triggers contain
checks that are not applicable to the import process.
Disable foreign key constraints – Disables all foreign keys of the tables before they are loaded,
and enable them afterwards. This can be necessary for self-referencing foreign keys. Foreign keys
between different tables will not lead to conflicts, because the tables are exported in a correct
order. Disabling foreign keys can also improve performance.
Commit every – Controls how many records will be inserted before a commit is executed. If this
value is zero, all inserts will be committed at once at the end of the SQL script. For large export
files and small rollback segments it will be necessary to supply an appropriate value here.
After selecting an output file, you can press the Export button to export the objects. If no specific
objects are selected in the grid, all objects will be exported. You can select objects by clicking on them,
and using the Control and Shift keys to select multiple objects and ranges of objects.
The output file is a SQL script that is compatible with Oracle’s SQL*Plus, and with PL/SQL
Developer’s Command Window.
The Include Privileges option can be enabled if you want to include the grants of the object privileges to
other users and roles. When the objects are recreated in a different database, these users and roles need
to exist for obvious reasons.
The Single file and File per object options control whether a single SQL script is created that contains
the DDL for all objects, or if each object should be exported to a specific file (with the object name as
filename, and .sql as extension). In that case the output file will contain a series of calls to these object
specific files. All files will be written to the directory of the output file.
PL/SQL Developer 5.1 User’s Guide 111
On the Selection tab page you can select the objects you wish to compare. After making this selection,
you can press the Target Session button, to select the user and database that you want to compare. This
will enable the Compare button, which you can press to start the compare operation. When this is
finished, the dialog will switch to the Differences tab page, which will show a list of all objects that are
different:
This list is sorted in order of dependency. Below the list of different objects of the target user, you see
the SQL that needs to be executed to make these objects equal to the corresponding objects of the
current user. If no object is selected, the SQL of all objects is displayed. If one or more objects are
selected, only the SQL for the selected object(s) is displayed. In the example above, an EMP_MGR_FK
foreign key constraint and an EMP_MGR_CHECK check constraint were added to the EMP table.
The Show Differences button will show a visual line-by-line difference of the old and new source file of
an object. This can be useful to view the changes made in Program Units, or can help you determine
why a specific DDL statement was generated for other object types. The Configure External Difference
Tool allows you to configure the difference tool should be used. By default the ExamDiff utility will be
used, for which a Pro version is available (See the About item of ExamDiff’s Info menu).
112 PL/SQL Developer 5.1 User’s Guide
You can now press the Apply SQL button to execute this SQL in the target session. You can
alternatively save the SQL in a file by pressing the Save SQL button, or you can copy it to the clipboard
by pressing the Copy SQL button.
When objects are compared, the following properties are ignored:
Storage – Properties such as the next extent and pct free of tables and indexes are not considered
relevant for comparison.
Constraints with system generated names – These constraints will have different names for the 2
users, so they cannot be compared. If a table is new in the target session, these constraints will be
generated though.
Table creation properties – Properties that would require the recreation of the table are ignored.
Table data – To export table data, use the Export Table function (see chapter 13.5).
Sequence values – The current value of a sequence is considered data.
Whenever such an event occurs, the name of the pipe or alert and the timestamp is written to the output
page, followed by the information of the event:
Pipe: all items of the message are displayed
Alert: the value of the message parameter of the dbms_alert.signal call is displayed
For alert events you can specify multiple names, separated by colons. For pipe events you can specify
just one pipe name.
PL/SQL Developer 5.1 User’s Guide 113
13.10 Sessions
The Sessions tool displays all sessions in the database instance you are currently connected to:
In the upper half of the window you see information about the sessions, such as the username, the sid
and serial number (which identify the session), the status, and so on. You can sort the session list by
clicking on the header button of a column. For example: to quickly find all active sessions, click on the
header button of the status column.
If you right-click on a session, this will bring up a popup menu with the following items:
Kill – Allows you to kill the selected session.
Enable SQL Trace – Enables SQL Trace for the selected session. This option will be disabled if
your Oracle Server version does not support this feature, or if you do not have privileges on the
dbms_system package.
Disable SQL Trace – Disables SQL Trace for the selected session.
Refresh list – Refreshes the session list.
Copy – Copies the session list to the clipboard.
Print – Prints the session list.
The Refresh, Kill, Enable SQL Trace and Disable SQL Trace functions are also accessible through the
toolbar at the top of the window.
The bottom half of the window contains several tab pages with information about the selected session.
The information on these tab pages can be refreshed, copied or printed by right-clicking on the list and
selecting the corresponding item from the popup menu. For more information about the individual
columns displayed in the lists, see the “Oracle Server Reference” guide.
114 PL/SQL Developer 5.1 User’s Guide
You can define your own queries for the session information tab pages, or modify the standard queries.
To do so, press the Define Session Queries button on the toolbar. This will bring up the following
dialog:
At the right side you see four buttons to create a new query, to delete a query, or to move a query up or
down in the list. When you create or modify a query you must supply the following information:
The Caption shows up on the tab pages of the session window. The position in the list determines the
tab-position in the session window.
The Query is the SQL select statement that fetches the session information. This select statement should
usually contain the :sid bind variable, which will contain the sid of the selected session when the query
is executed. You can use any of the columns of the v$session view though, such as the :username,
:sql_address, or :sql_hash_value. If your query leads to an error at run time, it will be displayed on the
corresponding tab page after execution.
In the example above the Cursors query displays all open cursors for the selected session, ordered by
the SQL text.
To configure the external tools, you’ll have to select the Configure External Tools menu item in the
Tools menu. The following dialog will appear:
The four buttons on the right allow you to insert and delete items, as well as to move items up or down
in the list. If you hold down the ctrl key when you press the insert button, the new created item will be
copied from the currently selected one.
The Execute button can be used to execute the selected tool. If you hold down ctrl when this button is
selected, a message will popup containing information (with replaced parameters) about what would
have been executed.
The list shows all configured tools and the bottom half shows the configuration of the selected tool. The
configuration is split into three sections:
General – to define the program to execute and its parameters
Menu – to define the place where the corresponding menu-item should appear
Button – to define a button image and description for the toolbar
Options – for some additional tool settings
To explain the external tool configuration we will add a SQL*Plus menu to PL/SQL Developer as an
example.
path as an alternative to a full path for the executable or file parameter. For SQL*Plus you could add a
connection string (#connect) and a link to a file to execute (#file).
The little button with the down arrow on the right allows you to pick a variable that you can be inserted
in any of the edits. These variables are all related to the current connection and opened file. They will be
replaced by corresponding information when the tool is executed. The following variables are
supported:
Variable Meaning
#file Represents the filename (without path) of the file in the current window
#path The filename with path
#dir The directory of the file in the current window
#object The selected browser object (e.g. SCOTT.EMP)
#otype The selected browser object type (e.g. TABLE)
#oowner The object owner (SCOTT)
#oname The object name (EMP)
#connect The full connect string of the current PL/SQL Developer connection (e.g. scott/tiger@demo)
#username The username
#password The password
#database The database
It turned out that SQL*Plus didn’t like a full path with possible spaces as file parameter, that’s why #dir
is specified as default directory so only the filename had to be passed to SQL*Plus.
If you want your tool menu item to be created in a specific main menu you can select one from the Main
Menu edit list or you can enter a new menu name if you want to create a new main menu.
If you have entered a Main Menu, you can use the Sub Menu and Sub-sub Menu to indicate the exact
location where you want to create your new menu item.
You can use the three radio buttons (Below, Above & At End) to specify where the new menu should
be placed relative to the specified menu. If you specify a new (sub) menu, you should always select ‘At
End’ because ‘Below’ and ‘Above’ only have a meaning if you refer to an existing (sub) menu.
Example 1:
Main menu Tools
Sub menu Oracle tools
Sub-sub menu
Location At End
This will create an Oracle tools sub menu in the Tools main menu. If you were going to add multiple
Oracle related tools, a specific submenu might be a good idea.
Example 2:
Main menu Oracle
Sub menu
PL/SQL Developer 5.1 User’s Guide 117
Sub-sub menu
Location At End
This will create an Oracle main menu. You should probably only create a new main menu if you are
using the tools regularly and you want them ‘close-by’.
If you want to add your tool as first item in the Tools menu you should enter:
Main menu Tools
Sub menu Preferences…
Sub-sub menu
Location Above
This will create a menu above the existing Preferences menu item.
Toolbar button
When this option is enabled, the external tool can be included on the toolbar.
Description
The description will be displayed as a hint when you hold the mouse cursor over the toolbar
button. If you leave this description empty, the description of the external tool (as displayed in the
menu) will be used.
Image
Press the image button to select a Windows bitmap file (*.bmp) for the toolbar button. The size of
this image should preferably be 20 x 20 pixels. Note that PL/SQL Developer will always load the
bitmap file from the original location, so you should not remove or rename this file without also
changing the corresponding external tool.
PL/SQL Developer comes with a number of standard bitmap files that you can choose from. These
files are located in the Icons subdirectory in the PL/SQL Developer installation directory. This is
the default directory of the image selector.
Save Window
When this option is set, the active Window will be saved before the tool is executed. You should
probably do this when the tool gets the file as a parameter and you want to be sure it uses the
current data.
Active Connection
If the tool is only useful if PL/SQL Developer is connected (if you pass the connect string as
parameter), you should set the Active Connection setting. This will disable the menu if PL/SQL
Developer is not connected.
Browser Object
Set this option if the tool works on selected objects in the browser
Window Types
If the tool requires a specific window, you can specify these in this section. If one or more are
selected, the menu will only be enabled if the active window type is specified.
PL/SQL Developer 5.1 User’s Guide 119
You can copy, paste, cut, delete, uppercase, lowercase, (un)indent, and (un)comment this selection as
usual. If you use the Apply Syntax Case function, and a keyword crosses the column boundary, it will
not be processed.
120 PL/SQL Developer 5.1 User’s Guide
As you continue to type the name of the dbms_alert procedure, the list will be reduced. If for example
you type an r after dbms_alert., only the register, remove and removeall procedures will still be present
in the list. When you press enter while the Code Assistant is visible, the name of the currently selected
item will be inserted into the source. You can also use the arrow keys to navigate through the Code
Assistant and select the desired item. Pressing the Escape key will remove the Code Assistant.
The Code Assistant will provide assistance for the following object types:
Object type Elements
Package Procedures, functions, types, variables, constants and exceptions
Function, Procedure Parameters, inserted with named notation (param => )
Table, View Columns
Sequence nextval and currval
User Objects owned by the user
table%rowtype variable Columns of the table
Object type Attributes (for default constructor)
Object type variable Attributes and methods
Object type column Attributes and methods
Collection variable Collection methods (first, next, limit, and so on)
The Code Assistant can also help you type the names of object (tables, packages, and so on), keywords
and PL/SQL identifiers that have meaning within the current context. If, for example, you type pro in a
SQL Editor and hesitate, the keywords procedure and profile will be displayed by the Code Assistant,
along with any database object name that starts with pro. The context depends on the currently
connected user (which determines the available object names), the type of editor (which determines the
available keywords), and the program unit you are editing (which determines the available PL/SQL
identifiers).
The Code Assistant can be automatically and/or manually invoked, and the delay time before the Code
Assistant automatically becomes active after typing an object name can be defined by a preference.
Furthermore you can define if you want to describe a user, and if so, which object types you want to be
included. The context description and the minimum number of characters that need to be typed before it
can be activated can be configured as well. All these preferences are described in chapter 13.1.
PL/SQL Developer 5.1 User’s Guide 121
The statements are displayed in order of execution, with the most recent one displayed first. In the list
you see the time, the user, and (part of) the statement text. You can now select a statement and double-
click it (or press Enter) to insert it at the cursor position in the editor from where the list was invoked.
You can sort the list by time, by user or by statement text by pressing the corresponding buttons in the
header of the list. To display just the statements that were executed by the currently connected user,
right click on the list and select the Current user item from the popup menu. In the same popup menu
you can switch back to All users, and you can delete a statement or copy the statement text to the
clipboard.
Note that statements that include passwords are not placed in the global statement recall buffer for
security reasons.
If, for example, you want to use this statement in Borland Delphi, you may need a format like this:
For this purpose you can use the Special Copy function from the Edit menu or from the popup menu
after right clicking on a selection in an editor. This function has a submenu, which shows all special
copy formats that are defined. After selecting a format, the converted code is stored on the clipboard, so
that you can paste it the editor of the corresponding tool.
122 PL/SQL Developer 5.1 User’s Guide
The special copy formats are defined in the SpecialCopy subdirectory in the PL/SQL Developer
installation directory. You can change the pre-defined copy formats, or add new copy formats. Simply
add a text file with a .copy extension that contains a variable for the first line of the PL/SQL code
(<line_1>), the last line of the PL/SQL code (<line_N>) and a variable for all other lines (<line_*>).
The example for Borland Delphi is as follows:
The first line needs to be preceded by the assignment to the SQL variable, and needs to be followed by a
CR/LF pair. The last line does not need the CR/LF pair, but needs to be terminated by a semi-colon. All
other lines merely need to be followed by CR/LF.
You can omit <line_1> and <line_n> if they are the same as <line_*>.
The name of the .copy file will be included in the menu.
14.9 Macros
The editor has a powerful macro function that allows for quick and easy macro recording and playback,
which can be used to automate a specific repetitive task.
A recorded macro can be stored in the Macro Library to be executed later. Macros in the library will
usually be some recurring repetitive task (like swap assignment: a := b; -> b := a;), or may contain code
PL/SQL Developer 5.1 User’s Guide 123
snippets. For example: why continuously look up how a cursor type must be declared when you can
type it once and record for later use?
To record a macro, press F11 or select the Record item in the Macro menu of the Tools menu. The
toolbar now displays a flashing recorder icon, indicating that you are currently recording a macro. All
keyboard strokes are recorded for playback, which implies that you should not use the mouse during
macro recording. By pressing F11 again, macro recording is ended. Pressing F12 will playback the
macro.
To store the currently recorded macro in the Macro Library, select the Library item in the Macro menu.
This will open the Macro Library dialog:
Press the New button to add a new macro with the currently recorded definition. You can enter a
description for the macro and indicate whether it should be included in the Macro menu. This way you
can make some macros easily available, and you can additionally assign a function key to each macro
through the Key Configuration preferences. If the Macros as main menu item option is checked, the
Macros menu is located in the main menu. If it is not checked, it will be located under the Tools menu.
When the Toolbar button option is enabled, the external tool can additionally be included on the
toolbar. The corresponding Description will be displayed as a hint when you hold the mouse cursor over
the toolbar button. If you leave this description empty, the main description of the macro (as displayed
in the library and in the menu) will be used. Press the Image button to select a Windows bitmap file
(*.bmp) for the toolbar button. The size of this image should preferably be 20 x 20 pixels. Note that
PL/SQL Developer will always load the bitmap file from the original location, so you should not
remove or rename this file without also changing the corresponding macro. PL/SQL Developer comes
with a number of standard bitmap files that you can choose from. These files are located in the Icons
subdirectory in the PL/SQL Developer installation directory. This is the default directory of the image
selector.
To execute a stored macro, open the Macro Library and double-click on its name. The selected macro
can now be executed by pressing F12. When you select a macro in the menu, it will immediately be
executed, and it can be re-executed by pressing F12.
124 PL/SQL Developer 5.1 User’s Guide
The Code Contents keep track of your current location in the source code. As you navigate through the
source code, the selected item will indicate where exactly you are located.
Double clicking on an item in the Code Contents will immediately navigate to its declaration. Right
clicking on it will display a popup menu that allows you to go to the declaration, to select the
corresponding source code, to describe the element, or to create a Test Script for it (if it’s a public
program unit).
The contents can be alphabetically sorted by pressing the Sort contents button at the top of the content
pane. Only the main contents will be sorted: parameters, local variables and so on will not be sorted.
The button will stay down, and pressing it again will revert the contents to their original order.
To close the Code Contents you can click on the Close button at the upper right corner. You can also
right click in the editor and select the Contents item to make it disappear or appear, or select the Code
Contents item in the Tools menu.
By default the Code Contents are visible. To change this default you can close the Code Contents in the
current Program Window and select the Save Layout item in the Window menu.
To easily find a declaration from within a Program Window, you can move the mouse pointer over such
a reference, hold down the Ctrl key, and press the left mouse button. After holding down the Ctrl key,
the identifier under the mouse pointer will become light blue and underlined, resembling the familiar
hyperlinks in an HTML document:
If the declaration is located within the same source, PL/SQL Developer will navigate there. After that,
the rest of the program units within the same Program Window will be searched. Then it will search all
other Program Windows that are currently open. Finally, it will try to open a new Program Window or
SQL Window for the object that contains the declaration and will navigate there.
By default hyperlink navigation will locate a declaration in a package or type specification, if
appropriate. To open the package or type body instead of the specification, you can right-click on a
hyperlink.
Bookmarks will be added when you navigate in the Code Contents, use the Find function, click on a
compilation error, go to the top or end of the editor, and so on.
126 PL/SQL Developer 5.1 User’s Guide
On the left side you see an Object Browser with just the tables and views. On the right you see the
work area, which is empty right now. At the bottom you see 3 panels with the field list (and optionally
the into item list), the where clause and the order by clause. The bottom section contains a tab page that
allows you to switch to the actual SQL text that would be created from the current query definition.
At the top of the window you see a toolbar with a New button to create a new query, an Open button to
open a previously saved query definition from a file, a Save button to save the current query definition
to a file, a Parse button to parse the current query definition, and a Preferences button. The OK button
returns you to the PL/SQL or SQL Editor and inserts the SQL text you have built.
PL/SQL Developer 5.1 User’s Guide 127
To include tables or views in the select statement, drag them from the Object Browser into the work
area. Each time you add a new table, the Table Properties dialog appears:
Here you can enter an alias for the table. For our example we wanted to use ‘e’ for the emp table:
After adding the Dept table in the same way, you are asked if you want to join the 2 tables using the
columns of the foreign key named EMP_FOREIGN_KEY:
After checking this option, you will see the new join condition in the bottom half of the form.
128 PL/SQL Developer 5.1 User’s Guide
Now the Dept table is added, and the join condition is visualized in the work area:
What we need to do now is include the columns in the field list of the select statement. Just click on the
checkbox next to the column names. The columns will be displayed in the Fields panel:
If you want to create a PL/SQL select .. into statement, you would also need to specify the items for the
Into list next to the fields. The selection list will display the PL/SQL variables that are defined in the
PL/SQL code where you insert the statement. In this case we do not want to create an Into list, so we
can leave these items empty.
PL/SQL Developer 5.1 User’s Guide 129
To create the order by clause, drag the empno column to the Order By panel:
Now you can press the OK button to insert the SQL statement into the editor.
Most of these preferences affect the layout of the generated select statement:
Keyword case
Determines how the SQL keywords (select, from, into, where, order by) are inserted into the
generated SQL statement.
Item case
Determines how the items (table names, column names) are inserted into the generated SQL
statement.
Keyword alignment
Determines whether the SQL keywords are right or left aligned.
PL/SQL Developer 5.1 User’s Guide 131
Comma separator
Determines whether commas are placed before the next item, or after the current item. This is
primarily of interest if the Single item per line option is enabled.
‘AND’ separator
Determines whether the ‘AND’ operator is placed before the next condition, or after the current
condition in the where clause.
Always prefix table with owner
When enabled, table names are prefixed with the owner (e.g. scott.emp instead of emp). When
disabled, tables are only prefixed with the owner if they are not owned by the current user.
Keywords on separate line
When enabled, a SQL keyword is placed on a separate line and all items are placed on subsequent
lines with a 2 character indent. If this option is disabled, the items will immediately follow the
keyword on the same line.
Single item per line
When enabled, each item will be placed on a new line. When disabled, items will be placed on a
single line, until the Right margin is reached.
Right margin
Determines the maximum length of each line when the Single item per line preference is disabled.
Always show table property editor
When this option is enabled, the table property editor will always be displayed after adding a new
table to the query definition. When this option is disabled, the property will only be displayed if
the newly added table is already used in the query, and therefore needs to have an alias.
Display SQL parts on a single page
Determines if the 3 SQL parts (Field list, Where clause, Order By clause) are displayed on a single
page. If this option is disabled, each part is displayed on a separate tab page, next to the tab page
of the SQL text.
132 PL/SQL Developer 5.1 User’s Guide
The Rules file determines the rules that will be followed when beautifying your code. You can leave it
empty to adopt the default rules, which can be defined through a default.br file in the PL/SQL
Developer installation directory. See the next chapter for more information about these rules.
Furthermore you can define when your PL/SQL code will be automatically beautified:
After Creating – Whenever a new program file is created through a template, or a DML
statement is dragged and dropped from the Object Browser into a Program Window.
After Loading – After a program file is loaded from the file system. This does not affect code that
is opened from the Oracle database.
Before Compiling – When you compile a program in the Program Window. This ensures that all
PL/SQL code in the Oracle database conforms to the rules.
Before Saving – Before a program file is saved to the file system.
PL/SQL Developer 5.1 User’s Guide 133
After making changes to these rules, you can press the Save or Save as button to save these changes.
You can also open another rules file for viewing or editing, and you can revert to the default rules by
pressing the corresponding button. If you save a file under a new name, or open a different file, you
need to select that rules file on the Options dialog to make these rules effective.
On the General tab page you can change the rules that apply to general aspects of your PL/SQL code.
All changes you make are immediately visible in the Preview pane at the bottom of the dialog, and most
options are self-explanatory. The following options need some explanations though:
Indent – The number of spaces that will be indented for nested structures such as begin/end,
if/then/else, loops, and so on.
Right margin – Whenever code needs to wrap to a following line, the right margin will be used as
a guideline. There may be situations where the right margin is exceeded though, for example when
long strings have been used.
Use tab character – When enabled, the resulting code will contain hard tabs (character 9) to
indent the code. When disabled, spaces will be used.
Tab character size – The number of characters that a hard tab represents. This is not only useful
when the Use tab character option is enabled, but can also be useful to correctly align comments
that contain hard tabs.
Empty Lines – You can define that empty lines should be removed, and that the beautifier will
insert empty lines by its own rules, or that groups of subsequent empty lines should be merged
into one empty line, or that all empty lines are preserved.
Item Lists – These rules apply to all item lists that do not fall into the categories of the other tab
pages.
134 PL/SQL Developer 5.1 User’s Guide
Syntax Case – Determines how PL/SQL keywords and identifiers are capitalized. The Use
Special Case option allows you to define a number of words that will be included with the
capitalization as specified. If, for example, you include DBMS_Output in this list, this will be the
exact capitalization of that word in your PL/SQL code.
The other tab pages contain rules that apply to specific aspects of your PL/SQL code. These rules are
again self-explanatory, and are demonstrated in the preview pane.
17. Templates
Whenever you create a new program unit, its initial contents are based upon a template which contains
pre-defined text and variables. When selecting a template, you will be prompted for the values of these
variables, which are then replaced in the template text.
Templates can also be used to insert pieces of SQL or PL/SQL code into existing source. You could for
example create a template for a cursor-for-loop, and use it whenever you need to program such a control
structure.
Templates are plain text files located in the Template directory and have a .tpl extension. Templates for
all program unit types are pre-defined, as well as templates for common SQL and PL/SQL constructs.
You can modify and create templates for your own specific requirements.
There are a number of templates that are pre-defined, and they are organized in the following template
folders:
Constants – Templates for PL/SQL constant declarations.
Default – Templates with the default contents of a SQL Window, Test Window, Command
Window or Explain Plan Window. It also contains the template for a new view object. You
probably won’t use these templates directly, but you can maintain them here.
DML Statements – Templates for DML statements that you can use in PL/SQL.
Loops – Templates for various kinds of PL/SQL loops.
Package elements – Templates for elements that can be used in package specifications or bodies.
PLSQL Types – Templates for all types that can be declared in PL/SQL.
136 PL/SQL Developer 5.1 User’s Guide
Program Units – This is a special folder that contains templates for new program units. Whenever
you create a new program unit, the template from this folder with the same name as the program
unit type will be used.
SQL Functions – Templates with all SQL functions, like add_months, substr, and so on. These
templates can be useful if you don’t know the exact name or parameter meanings of a specific
function.
Type elements – Templates for elements that can be used in type specifications or bodies.
Variables – Templates for PL/SQL variable declarations.
By default the Template Window is docked under the Object Browser, but you can turn it into a floating
window by right clicking on it and selecting the Float item from the popup menu. To dock the window
again, follow the same procedure.
You can close the Template Window by selecting the Close item in the popup menu. To make the
Template Window visible again, select the Templates item in the Tools menu.
You can save this layout for the next time you start PL/SQL Developer by using the Save Layout item in
the Window menu, which will save the current situation. This function is described in more detail in
chapter 20.2.
After filling the form and pressing the OK button, the template text will be inserted into the source, at
the current cursor position:
You can also drag-and-drop a template from the Template Window to a specific position in an editor.
This position will also determine the indentation of the template text. Similarly you can right-click at a
location in the editor, and select a template item from the Templates submenu from the popup menu.
Template text
The template specification contains literal text and variables. The literal text will simply be copied into
the source file without any modification. Consider a template called Commit that only contains the
literal text commit;. When this template is double-clicked, the text commit; is inserted into the source at
the cursor position. Square brackets indicate a variable in a template (see below), so if you want to use a
square bracket as literal text, use 2 brackets instead, For example: [[option]]
User variables
Template variables are codes in the template text that will be replaced with a substitution text. This
substitution text can be an implicit value, like the current date or the username, or can be user-specified.
These user variables will appear in the entry form when the template is invoked. The following example
defines the variables Name and Type for a function template:
When this template is invoked, the user can specify the values for the Name and Type variables. As you
can see, the Name variable is used twice. The user will be prompted for it only once though, and both
occurrences will be replaced with the same value.
The following functionality is available for user variables:
Default value.
A default value for a variable can simply be placed after the variable name. To define varchar2 as
the default function type, you can use the following declaration:
[Type = varchar2]
Restricted list.
To restrict the possible values for a variable, you can define it as a list of values. To limit the
function types to varchar2, number and date, you can use the following declaration:
[Type = varchar2, *number, date]
The value preceded with an asterisk will be used as default.
Suggestion list.
To provide a user with a list of suggested values, allowing other values for the variable as well,
use ... as the last value in the list:
[Type = varchar2, number, date, ...]
Descriptive list
Instead of using the same text for the list items and the substitution text, you can also use a
description for each item. Just follow the description with a colon and the value:
[Level = Write No Database State:WNPS, Read No Database State:RNDS, ...]
Check box.
For variables that are actually options, you can use a check box. Place a slash between the values
for an unchecked (left) and checked (right) check box. The following variable will insert the text
for each row when the check box is unchecked, and will insert for each statement when the check
box is checked:
[Statement level? = for each row / for each statement]
If you want to use special characters (like comma’s, brackets, and so on) in a substitution text, you can
place the text between double quotes.
The following is an example of a template for a trigger, using just user variables:
Note that you can create multiple program units in one template by separating them with a line with just
a slash (/) character. This way you can create a templates for a package specification and body in a
single program file.
PL/SQL Developer 5.1 User’s Guide 139
When this template is used, the user will be prompted for the variable values in the following way:
Implicit variables
Besides the user variables you can additionally use implicit variables. The substitution text for these
variables are not specified by the user, but are defined by the system (date, username), or the template
developer (queries, text).
System variables
The following 4 system variables are defined:
$OSUSER – The name of the Operating System user.
$DBUSER – The name of the database user that is currently logged on.
$DATE – The current date.
$TIME – The current time.
The first 2 lines of the following example template inserts the Windows user and the current date/time
into a source file:
-- Author : $OSUSER
-- Created : $DATE $TIME
-- Purpose : [Purpose]
procedure [Name] is
begin
;
end [Name];
Note that system variables do not use square brackets in the template text, but are preceded by a $ sign.
If you want to use the original name of a system variable to appear in the resulting text instead of the
substitution value, you can escape this by placing a second $ sign before the name. For example:
-- $$Date$ $Revision$
Cursor position
The cursor position variable determines where the text cursor will be located in the editor after the
template text is inserted into an editor. Just place [#] at the desired location:
loop
[#]
end loop;
Query variables
You can use queries to populate selection lists in a template. The following example defines the query
seq_query, which is subsequently used as a suggestion list for the Sequence variable:
[$QUERY seq_query =
select lower(object_name) from user_objects
where object_type = 'SEQUENCE'
order by object_name]
select [Sequence=$seq_query,...].nextval into [Variable name] from dual;
The Sequence variable is a suggestion list, because the query is followed by “,…”, implying that other
values can be entered manually by the user. Query results can simply be viewed as comma separated
lists of values.
As a result, the user doesn’t have to type ‘where’ in the search condition. To exclude a piece of text, use
the –Variable name syntax instead of the +Variable name syntax.
Text variables
You can define text variables in a template and refer to these variables in other parts of the template.
This is particularly useful if you want to conditionally include large pieces of text. The following
example includes an exception block if the user indicates so:
[$TEXT exception_block=
exception
when no_data_found then ...
when too_many_rows then ...
when others then ...
end;]
select [Item list]
from [Table list]
into [Variable list]
where [Search condition];
PL/SQL Developer 5.1 User’s Guide 141
Template icons
The tree view in the Template Window displays an icon for each template. The Template Window first
looks for a bitmap with the same filename as the template. For template Cursor.tpl, it will display a
Cursor.bmp from the same directory, if present. If this bitmap is not present, it will look for a
Cursor.bmp in directories below the current directory. If this bitmap is not found either, it will look for a
default.bmp file in the current directory and the directories below.
The bitmaps for the template icons should have a size of 16x16 pixels with 16 colors.
142 PL/SQL Developer 5.1 User’s Guide
If you click on one of these items the corresponding window will be activated. If you right click on an
item in the Window List, the following popup will be displayed:
From this popup menu you can activate, close, and resize the window to a normal or minimized state.
Furthermore you can rename a window. This can be useful if you just created a new window and want
to provide a meaningful name instead of, for example, SQL Window – New.
The New menu item allows you to create a new Program Window, SQL Window, Test Window,
Command Window or Explain Plan Window.
To execute a certain window, you can select the Execute menu item.
You can turn the Window List into a floating window by selecting the Float item. To dock the window
again, follow the same procedure. To close the Window List, select the Close item. To make the
Window List visible again select the List item in the Window menu. You can save this layout for the
next time you start PL/SQL Developer by using the Save Layout item in the Window menu, which will
save the current situation. This function is described in more detail in chapter 20.2.
PL/SQL Developer 5.1 User’s Guide 143
After this index build is finished, you will be presented with a list of manuals that have been found. You
can now select the books you want to use for context sensitive help. By default this selection will
include the Error Messages, SQL Reference and PL/SQL Reference manuals, which all contain relevant
information during PL/SQL development. The Error Messages manual is required if you want to
automatically have the cause and action available in case of an Oracle exception or compilation error.
The current Oracle7 manual is not properly indexed to allow this feature, the Oracle8 version works
without a problem though.
Press the Apply button to make the selection effective. After this you are taken to the search page, which
is discussed in the following chapter. By pressing the Setup button you can scan a different directory for
HTML manuals.
PL/SQL Developer 5.1 User’s Guide 145
You can double click on a topic to display the corresponding paragraph in the HTML manual:
The search result page displays an HTML page in which you can navigate through hyperlinks as usual.
The two buttons at the top of the page can be used to navigate to the previous or next location that you
visited before.
You can go back to the Search page to search for different keywords or go to the Books page to select
different books.
146 PL/SQL Developer 5.1 User’s Guide
20. Customization
Some aspects of PL/SQL Developer can be customized to meet your personal needs. These aspects are
described in the following paragraphs.
20.1 Preferences
In the Tools menu, there is a Preferences item that allows you to set various preferences for PL/SQL
Developer. These preferences are described in detail in chapter 13.1.
To configure on-line documents, select the Configure Documents item in the Tools menu. The
following dialog allows you to define a description of each document, and how to view it:
At the right side you see four buttons, to create a new document, to delete a document, and to move a
document up or down in the menu. When you create or modify a document you must supply the
following information:
The Description shows up in the menu. To create a shortcut key for the menu item of a document, prefix
the letter in the description with an ampersand. If you want an ampersand in the description, use two
ampersands instead. If you enter just a '-' into the description, it will become a separator in the menu.
This way you can divide the documents into logical groups.
The Executable should be the full path to the program that you want to use to view the document. If the
document is a registered file type (like an MS Help file or HTML file), you can enter the path to the
document here.
The Parameters can be used to pass information to the executable if it is a program. It should at least
include the path to the document, but can also be used to pass options to the program.
When the Documents as main menu item option is checked, the Documents menu is located in the main
menu. If it is not checked, it will be located under the Tools menu.
In the above example the PL/SQL Reference Manuel is a PDF file (P:\O9DOC\A89856_01.pdf), which
is a registered file type, so that can just enter the file name in the Executable field. The letter 'P' is used
as a shortcut in the menu. The Documents menu would look like this:
When the Toolbar button option is enabled, the document can additionally be included on the toolbar.
The corresponding Description will be displayed as a hint when you hold the mouse cursor over the
toolbar button. If you leave this description empty, the main description of the document (as displayed
in the menu) will be used. Press the Image button to select a Windows bitmap file (*.bmp) for the
148 PL/SQL Developer 5.1 User’s Guide
toolbar button. The size of this image should preferably be 20 x 20 pixels. Note that PL/SQL Developer
will always load the bitmap file from the original location, so you should not remove or rename this file
without also changing the corresponding document. PL/SQL Developer comes with a number of
standard bitmap files that you can choose from. These files are located in the Icons subdirectory in the
PL/SQL Developer installation directory. This is the default directory of the image selector.
For security reasons you may not want to store passwords in the history, even though PL/SQL
Developer encrypts them. This would imply that anyone could connect to the database with your
accounts if they have access to PL/SQL Developer on your PC. To configure the Logon history
functionality, select the Configure item in the popup menu of the Log on button on the toolbar:
On the Definition tab page you can define if you want to store the Logon history at all, define if the
password should be stored, and define how many entries will be stored. If more than this number of
accounts is used, the oldest one will be removed from the history.
Note that even if you have selected to store passwords in the logon history, you can still prevent this by
holding down the Control key when pressing the Return key or the OK button during logon. This way
you can prevent that passwords of privileged accounts (e.g. SYS or SYSTEM) can be recalled.
You can additionally define a number of fixed accounts on the Fixed users tab page, with or without
password. These fixed accounts will always be displayed and will never automatically be removed.
On the Added users tab page you can see which users were added to the history as a result of a logon in
PL/SQL Developer. To delete a specific item, select it and press the Delete item button below the list.
PL/SQL Developer 5.1 User’s Guide 149
userid
Every time you start PL/SQL Developer, it will prompt you for at least the password. To avoid this, you
can supply a userid parameter with the familiar username/password@database format:
plsqldev.exe userid=scott/tiger@chicago
Note that you can also the following registry key to supply a default logon:
HKEY_CURRENT_USER\Software\Allround Automations\PL/SQL Developer\Logon
Here you can add a Username, Password and Database.
The last method has the advantage that it enables you to be automatically logged on after double
clicking a PL/SQL Developer registered file.
nologon
The nologon parameter suppresses the logon dialog that is displayed when PL/SQL Developer is
started. This parameter does not require any arguments:
plsqldev.exe nologon
oraclehome
You can specify the name of the Oracle Home on the command line, thereby overriding the Primary
Oracle Home (which is used by default) and the Oracle Home preference:
plsqldev.exe oraclehome=ora817
Note that this is the name of the Oracle Home, as specified in the ORACLE_HOME_NAME key in the
registry. This name is also used by the Oracle Home Selector. It is not a registry section name or a
directory name.
dontadjustpath
PL/SQL Developer will not temporarily modify the PATH for Oracle Net initialization:
plsqldev.exe dontadjustpath
nosplash
The nosplash parameter suppresses the splash screen that is displayed when PL/SQL Developer is
started. This parameter does not require any arguments:
plsqldev.exe nosplash
noplugins
Specifying the noplugins parameter will prevent that any Plug-Ins are loaded:
plsqldev.exe noplugins
library
Specify the location of the style library for reports:
plsqldev.exe library=p:\standard.lib
150 PL/SQL Developer 5.1 User’s Guide
20.7 Plug-Ins
You can program your own Plug-Ins to extend the functionality of PL/SQL Developer. Functions in a
Plug-In can be added to the PL/SQL Developer menu, and can perform any kind of action: access the
database, the Object Browser, the current window and editor and so on.
A Plug-In is a DLL that exposes a specific interface to PL/SQL Developer. To create a Plug-In, you can
use any programming language that can create DLL’s. When a Plug-In DLL is placed in PL/SQL
Developer’s Plug-In directory, it will automatically be picked up. This makes it very easy to distribute
your Plug-Ins.
You can build Plug-Ins for your own or public use. Some standard Plug-Ins are available on the
Allround Automations web site (http://www.allroundautomations.com/plsqldev.html). Third party Plug-
Ins are available here as well.
Plug-In documentation and examples are available in the PluginDoc subdirectory in the PL/SQL
Developer root directory.