Use the Commands page of the Command
Editor to execute commands and SQL statements.
About this task
The Command Editor is a notebook with a page for entering
commands and pages for retrieving results. The appearance of this
notebook changes depending on the target for your commands.
Procedure
To execute commands and SQL statements:
- Select the target on which you want to execute the commands
or SQL statements. A target can be any DB2® database for Linux, UNIX, and Windows, z/OS® and OS/390® system or subsystem, or
IMSplex that you can connect to. Targets that currently have connections
or have had connections during the current session are listed in the Target drop-down
list. If your target is not listed, click Add and
select a target from those available on the Specify Target window.
- In the top pane, type the commands or SQL statements that
you want to execute.
You can select commands and statements
previously executed in this session from the History window.
Click to open the History window.
You
can execute commands and statements stored in a file. Click to locate the file using the file browser Open window.
- You can specify the character to be used as the termination
character for your statements and commands in the Statement
termination character field. This termination
character will override the character that you may have specified
in the Tool Settings notebook.
You want
to specify a different termination character:
- For scripts containing CREATE PROCEDURE or CREATE TRIGGER statements,
it is suggested that a termination character other than a semicolon
be used, as the body of these statements might themselves contain
one or more semicolons.
- When stored procedures are using the same character as a delimiter,
as this would cause execution problems.
- Perform one or more of the following actions:
- Click to execute the commands or
statements.
- Click to generate a graphical
representation of the access plan for explainable SQL statements (for
example, SELECT, INSERT, and UPDATE). An access plan indicates the
order of operations for accessing requested data.
- Click to execute
explainable SQL statements and generate access plans.
Note: The availability of push buttons changes depending on
the target for your commands.
- View the execution results. Command results
are displayed in the output area of the Commands page,
while SQL results are returned on the Query Results page.
The access plan appears in graphical form on the Access
Plan page.
- Optional: The results from the most recently
executed SQL statement are displayed on the Query Results page. To change the value in any cell, highlight the value and modify
it. If the Automatically commit updates check
box is selected, changes made to a cell are committed immediately
when focus shifts off its row. If the check box is not selected, then
click Commit to commit your changes, or click Rollback to
rollback any uncommitted changes.
You can also add and delete
rows in the table.
- Optional: You can save your commands and statements
in a file. Click to
specify a file using the file browser Save As window.