The query execution perspective

Use the query perspective to execute SQL statements. To switch to this perspective, use the Perspective ▸ Query execution (SQL) menu, or the Ctrl+S shortcut.

Query exec perspective

The query exec perspective with one SELECT statement executed

The perspective is divided in two horizontal panes: the left pane for the user defined favorite statements, and the right pane being the action area.

In the figure above, there are two favorites: a SELECT statement (named "List customers") and an INSERT statement (named "New customer ..."). The INSERT statement needs one "name" parameter, whereas the SELECT statement does not require any parameter to be executed.

The icon difference between the two illustrates the fact that the INSERT favorite is also marked to be an action: it will be proposed as an action to be executed when the contextual menu is brought up in any grid representation of a resultset.

The left part of the perspective lists the favorite statements which have been user defined. Activating a favorite (double clicking) resets the SQL text area's contents to the selected statement's SQL.

The right pane is composed of zero or more tabs where the SQL is entered and executed. In each tab there is:

  • an SQL area in the top left part

  • command buttons in the top right part

  • execution history in the lower left part

  • execution results in the lower right part

SQL area

The SQL area is an SQL editor. The SQL can be any SQL understood by the database, with the exception of variables (which must have a specific syntax).

The keyboard shortcuts in the SQL editor are:

  • Ctrl+SPACE to obtain a completion list

  • Ctrl+ENTER to execute the SQL code

  • Ctrl+l to clear the editor

  • Ctrl+Up and Ctrl+Down to navigate through the editor's history

Command buttons

The commands available through the command buttons are:

  • Clear: clears the editor (similar to the Ctrl+l shortcut)

  • Variables: shows or hides the variables panel where you can give values to the variables present in the SQL code. The panel is automatically shown when a variable is detected in the SQL code

  • Execute: executes the SQL code. If the SQL code contains some variables which have not been set, then a popup first appears requesting the variables to be given values. This is similar to the Ctrl+ENTER shortcut

  • Indent: re-indents the SQL code (warning: this removes any comments)

  • Favorites: adds the current SQL code to the favorites

Execution history

The execution history part contains a list of the past executed statements, ordered by execution date along with an indication when the statement was executed (11 minutes in the figure above). Selecting an history item displays the corresponding result in the execution results part.

The Copy button copies the currently selected history item's SQL code to the SQL editor, and the Clear button removes all the history items.

Note that any given history item can also be removed individually using the Suppr key.

Execution results

The Execution results part displays the execution result of the currently selected execution history item, as a table for SELECT statement, giving information for other types of statement, or giving the execution error notice if the execution failed.