SQL Command Processor
SQL Workshop
gives the user access to the SQL Command Processor. It is here
that any SQL statement within the rights and permissions of the
HTML DB user can be typed in and executed. Any SQL statement or
PL/SQL block can be entered and executed. The screen is
divided between the statements entered by the user and the
results of the statement after execution. The statements can be
a SELECT, an UPDATE, a DELETE, INSERT, CREATE TABLE, GRANT, or
any other command. It is a great interface that allows users to
do exactly what they need to do. Figure 5.10 shows the default
display of the SQL Command processor.
It is a simple matter of entering the
statement the user wishes to run and then executing it. The
statements can be executed either by pressing the Run button or
by pressing the key combination CTRL+Enter. I typically use
the CTRL+Enter because my hands are already on the keyboard.
In Figure 5.11, a simple SELECT statement has been entered into
the SQL Command processor and executed by pressing CTRL+Enter.
The results are shown in the results section of the screen.
The Autocommitand Display
items at the top of the processor might be unfamiliar. After
each statement is executed, a commit will be issued depending on
whether the Autocommit checkbox is checked or not. This will
save users from having to commit the data after an INSERT,
UPDATE, or DELETE. The Display drop down offers the option of
how many rows to display after a Select statement. To see more
rows than which is shown, simply choose a higher number and
re-run the statement.
Note: This interface does not support
SQL*Plus commands other than the familiar DESCRIBE (DESC)
command.
There are also different tabs of the results
section. The following table contains an explanation of each:
|
TAB |
DESCRIPTION |
|
Results |
Shows the results of the SQL or PL/SQL
that have been entered. |
|
Explain |
Run the Explain Planon the SQL statements that are in use. See the
detail explanation later in this chapter. |
|
Describe |
Describes the structure of a table. |
|
Saved SQL |
These are saved SQL statements that all
the developers can use. Typically these are saved without
values in the statement. These would be supplied when
needed. |
|
History |
HTML DB will save the last 120 commands
that have been run. The history can be used to recall the
statement to run again. |
For practice, create a table using the SQL
Command processor. The following
create_easy_products.sql
script shows the CREATE TABLE command for a table called
products.
This statement can simply be typed into the
SQL Command processor and executed. Also, the
create_easy_products.sql
file from the online code depot can be used and executed.
Figure 5.12 shows what this step looks like. Assuming all went
well, the Table Created message will be displayed. Very
simple! If the syntax of the command is incorrect, an error
statement will point the user to their mistake. Those familiar
with other Oracle products will recognize these errors as the
default Oracle errors.
Figure 5.13 shows the execution of an INSERT
statement to add data to the table.