Using the SQL Worksheet


You can use the SQL Worksheet to enter and execute SQL, PL/SQL, and SQL*Plus statements. You can specify any actions that can be processed by the database connection associated with the worksheet, such as creating a table, inserting data, creating and editing a trigger, selecting data from a table, and saving that data to a file.

When you connect to a database, a SQL Worksheet window for that connection is automatically opened. You can also display a SQL Worksheet by selecting Tools and then SQL Worksheet, or by clicking the Use SQL Worksheet icon under the menu bar. In the Select Connection dialog box, select the database connection to use for your work with the worksheet. (You can also use that dialog box to create and edit database connections.)

The SQL Worksheet has the user interface shown in the following figure:

SQL Worksheet interface

SQL Worksheet toolbar (under the SQL Worksheet tab): Contains icons for the following operations:

The right-click menu includes the preceding SQL Worksheet toolbar operations, plus the following operations to support file-oriented development:

Enter SQL Statement: The statement or statements that you intend to execute. For multiple statements, each non-PL/SQL statement must be terminated with either a semicolon or (on a new line) a slash (/), and each PL/SQL statement must be terminated with a slash (/) on a new line. SQL keywords are automatically highlighted. To format the statement (capitalizing the names of statements, clauses, keywords, and so on), right-click in the statement area and select Format SQL.

You can drag some kinds of objects from the Connections navigator and drop them into the Enter SQL Statement box:

Tabs display panes with the following information:

Related Topics

SQL*Plus Statements Supported and Not Supported in SQL Worksheet

Script Runner

Execution Plan

Using Snippets to Insert Code Fragments

Using the SQL Worksheet for Queries (tutorial)

SQL Developer Concepts and Usage

SQL*Plus Statements Supported and Not Supported in SQL Worksheet

The SQL Worksheet supports some SQL*Plus statements. SQL*Plus statements must be interpreted by the SQL Worksheet before being passed to the database; any SQL*Plus that are not supported by the SQL Worksheet are ignored and not passed to the database.

The following SQL*Plus statements are supported by the SQL Worksheet:

@
@@
acc[ept]
conn[ect]
def[ine]
desc[ribe]
doc[ument]
exec[ute]
exit (Stops execution and reinstates the specified connection)
pro[mpt]
quit (Stops execution and reinstates the specified connection)
rem[ark]
sta[rt]
undef[ine]
whenever

The following SQL*Plus statements are not supported by the SQL Worksheet:

a[ppend]
archive
attr[ibute]
bre[ak]
bti[tle]
c[hange]
cl[ear]
col[ulmn]
comp[ute]
copy
del
disc[onnect]
ed[it]
get
help
ho[st]
i[nput]
l[ist]
newpage
oradebug
passw[ord]
pau[se]
print
r[un]
recover
repf[ooter]
reph[eader]
sav[e]
sho[w]
shu[tdown]
spo[ol]
startup
store
timi[ng]
tti[tle]
var[iable]

Related Topics

Using the SQL Worksheet

Script Runner

The script runner emulates a limited set of SQL*Plus features. If you do not have SQL*Plus on your system, you can often enter SQL and SQL*Plus statements and execute them by clicking the Run Script icon. The Script Output pane displays the output.

The SQL*Plus features available in the script runner include @, @@, CONNECT, EXIT, QUIT, UNDEFINE, WHENEVER, and substitution variables. For example, to run a script named c:\myscripts\mytest.sql, type @c:\myscripts\mytest in the Enter SQL Statement box, and click the drop-down next to the Execute Statement icon and select Run Script.

The following considerations apply to using the SQL Developer script runner:

If you have SQL*Plus available on your system, you may want to use it instead of the script runner. To start SQL*Plus from SQL Developer, click Tools and then SQL*Plus. For information about SQL*Plus, see Using SQL*Plus.

Related Topics

Using the SQL Worksheet

Execution Plan

The Execute Explain Plan icon generates the execution plan, which you can see by clicking the Explain tab. The execution plan is the sequence of operations that will be performed to execute the statement. An execution plan shows a row source tree with the hierarchy of operations that make up the statement. For each operation, it shows the ordering of the tables referenced by the statement, access method for each table mentioned in the statement, join method for tables affected by join operations in the statement, and data operations such as filter, sort, or aggregation.

In addition to the row source tree, the plan table displays information about optimization (such as the cost and cardinality of each operation), partitioning (such as the set of accessed partitions), and parallel execution (such as the distribution method of join inputs). For more information, see the chapter about using EXPLAIN PLAN in Oracle Database Performance Tuning Guide.

Related Topics

Using the SQL Worksheet

DBMS Output Pane

The PL/SQL DBMS_OUTPUT package enables you to send messages from stored procedures, packages, and triggers. The PUT and PUT_LINE procedures in this package enable you to place information in a buffer that can be read by another trigger, procedure, or package. In a separate PL/SQL procedure or anonymous block, you can display the buffered information by calling the GET_LINE procedure. The DBMS Output pane is used to display the output of that buffer. This pane contains icons and other controls for the following operations:

Related Topics

Using the SQL Worksheet

OWA Output Pane

OWA (Oracle Web Agent) or MOD_PLSQL is an Apache (Web Server) extension module that enables you to create dynamic Web pages from PL/SQL packages and stored procedures. The OWA Output pane enables you to see the HTML output of MOD_PLSQL actions that have been executed in the SQL Worksheet. This pane contains icons for the following operations:

Related Topics

Using the SQL Worksheet