Previous Topic

Next Topic

Book Contents

Book Index

Running your SQL

You can run your SQL by clicking on Run or hitting F5. AQT will pass your SQL to the database then display the data (if there are any). If there are any error messages, you will see them on the status bar at the bottom of the window.

Run only part of SQL

If you only want to run part of your SQL, select the part you want to run and click on Run. If you have text selected, AQT will run only the selected text.

Select current statement

If your SQL consists of multiple statements, hitting Run > Select Current Statement (or F4) will select the current statement. You can then run this with F5.

Run to Cursor

You can run all the SQL up to the position of the cursor by selecting Run > Run to Cursor.

Run within Brackets

You can run the SQL within the brackets containing the cursor by selecting Run > Run within Brackets.

This is useful for running sub-select clauses.

Pausing a query

If you are running a query that returns a large number of rows then you can Pause the query.

In order to do this, you need:

If so, then when you run a query you will get a Pause button in the toolbar. Clicking in this will pause the fetching of the data. The data will be shown in the Data Display window. You will then have the option to either:

Note that while the query is still open you will be holding some database resources. This feature should be used with caution.

Cancel a query

AQT allows you to cancel a long-running query. This is discussed more detail in Options > Cancel Queries.

Syntax-check SQL

You can do a Syntax Check of your SQL. You do this with Edit > Check Syntax (or F6). AQT does the syntax check by doing a “prepare” of your SQL against your database. This feature does not work with some databases (depending on whether “deferred prepare” can be disabled).

Explain plan

For Oracle, DB2 z/OS, DB2/UDB, SQL Server, Sybase, MySQL, IDMS and Teradata you can do an Explain Plan of your SQL. You do this by Edit > Explain Plan (or F8). See Explain Plan for more information on Explain Plan.

Show Query Cost

This function is available for DB2/UDB, DB2 z/OS and Oracle. This does an Explain of your query and returns the estimated query cost.

This is similar to Explain but doesn't show the explain window. It is useful if all you want to know is the cost of the query.

Running a DB2 Command

AQT can run a DB2 Command by invoking the DB2 CLP (Command Line Processor). This is described in the section Running a DB2 Command.

Running using SQL*PLUS

You can run your SQL under SQL*PLUS by selecting Run > Run using SQL*PLUS. AQT will invoke SQL*PLUS and pass your SQL to this.

This can be useful if you are trying to debug a complicated piece of SQL. AQT cannot display the line / columns where an error has occurred (this is a limitation of the ODBC driver). However, SQL*PLUS can display this information.

This function is for Oracle only.

Advanced Query Tool
© 2023 Cardett Associates Ltd. All rights reserved.