Use the IBM® Z Database Assistant SQL editor to
write, execute, and format SQL statements.
About this task
The SQL editor provides an environment for working with SQL statements including syntax
highlighting, auto-validation, auto-completion, formatting, and exporting. You can work with
multiple query editor tabs simultaneously, and you can easily run either a collection of queries or
individual queries.
Tip: Ask the Assistant about SQL statements and how to enter them.
Procedure
To edit and run SQL:
- From the side navigation panel, select the IMS system that you want to work with and
click the SQL editor tab.
An empty query editor tab opens, which
is titled query1.sql by default. You can open additional editor tabs by
clicking the plus sign (+) to the right of the current editor tab.
- Position your cursor in the query editor page and enter an SQL statement.
As
you write a statement, you can use the following productivity features:
- Use undo and redo to remove and re-add changes to a statement.
- Format the SQL to restructure a statement into a format that is easier to parse.
- Select a different PSB. The new PSB becomes the default for that query editor page. The default PSB for each query is DFSCP000.
- Highlight a section of SQL and copy the SQL to the clipboard.
-
When you are ready to run the SQL, click Run all to run all of the
statements in the active query editor pane.
If you've created multiple SQL statements in the same query editor tab, you can run a subset
of those statements by highlighting them and clicking
Run selected from the
Action menu.
The query runs and the results are displayed in the query
result tab below the editor. The query is also added to the Recent queries
side pane, where it can be inserted into the query editor pane by clicking it. The query history
persists for the duration of the current login session.
- In the Query column of the Query result pane, click an SQL statement to display more
details and results.
The Results tab displays the data that is
returned by the statement. This tab provides a search facility for locating specific values and an
export facility for saving the results as a CSV file.
- Optional: To export the query to a CSV file, click the
Results tab and click the Export icon in the upper
right of the Results pane.