Executing SQL Queries


The Query Editor supports a number of different ways to execute single or multiple SQL statements using a single database connection from the one open editor.

The following execution techniques are supported:

To open a Query Editor within the central pane select the menu item Tools > Query Editor or select the Query Editor button from the main toolbar.

All query output as shown in the editor's output pane may be written to file. Configure this option within the user application preferences.

The editor's database connection may changed at any time using the connections drop-down list within the editor's toolbar.

Execute all Content by Parsing

Single or multiple statements may be executed at the same time using the current editor's connection by selecting the Execute button from the editor's toolbar (shortcut - F5). This will execute each statement in turn parsing all the text first and splitting each individual query on the query terminator the semi-colon (;) as shown below.


1.  SELECT first_name, second_name FROM people;
2.  INSERT INTO people (first_name, second_name) 
3.  VALUES ('John', 'Smith');

In the queries shown above each statement is executed in turn, the first returning a result set, the second a numeric result of the number of rows affected by the query.

Statements may or may not return result sets. Query execution results are shown in 'real-time' within the editor's output pane. Where the query does not return a result set, the execution result is shown within the editor's output pane. In the case of one or more result sets returned from the execution of multiple SELECT statements (or similar) each result set shall be displayed within its own results pane as a tab. See Viewing query result sets for further information on result set display and manipulation.

Execute Query at Cursor Position

Executing a query at the current cursor position allows for the execution of a single SQL statement from within the editor that may or may not contain other statements.

To execute a query at the current cursor position select the Execute query at cursor button from the editor's toolbar (shortcut Ctrl+ENTER).

In order for the editor to determine the query start and end points, a single whitespace line is required between queries. The query terminator semi-colon (;) is not required in this case (but may be provided).

The current cursor position and the statement that this relates to is determined by the combination of the nearest query text and the surrounding empty lines where the editor will look before its current position to determine the query start point.


1.  SELECT first_name, 
2.         second_name 
3.  FROM people;
4.
5.  INSERT INTO people (first_name, second_name) 
6.  VALUES ('John', 'Smith')
7.
8.
9.  UPDATE people SET first_name = 'Robert'
10.  WHERE people_id = 9652;
11.
12.

In the example above, the first statement would be executed by placing the cursor anywhere on lines 1 to 4. Similarly, the second and third statements would be executed by placing the cursor anywhere on lines 5 to 8 and lines 9 to 12 respectively.

An indicator is placed on the line number where the start position of the query was determined. This will remain there until any key stroke is performed within the editor.

Execute Selected Text

Selecting (highlighting) a portion of SQL query text and selecting the Execute the current text selection button from the editor's tool bar (shortcut Ctrl+SHIFT+ENTER) will execute the selected portion as a single statement.

Execute all as a Single Statement

In the case of more complex queries or creation of procedures and functions, it may be desirable to execute all the editor's text as a single block without parsing the text for query-terminators.

To execute the entire editor contents as a single block statement use the editor's popup menu (right-click) and select the menu item Execute as Single Statement. The query will be sent to the database in its entirety (as-is) and parsing of special characters will not be performed.