DBeaver Documentation


SQL Execution

You can execute one query, a highlighted portion of a script, or a whole script. You can execute them using the following:

  • Shortcut key combinations (see details further in this article)
  • Tools in the main toolbar:

Note: toolbar is customizable. See Toolbar Customization

  • Context menu (right-click the query):

  • DBeaver main menu:

To execute a query under the cursor or selected text, press Ctrl+Enter or right-click the query and click Execute -> Execute SQL Statement on the context menu. You can do the same using the main toolbar or main menu: SQL Editor -> Execute SQL Statement. This executes the SQL query under the cursor or selected text and fills the results pane with the query results.

To execute a query under the cursor in a separate tab, press CTRL+\ or right-click the query and click Execute -> Execute SQL in new tab on the context menu. The same can be done using the main toolbar or the main menu: SQL Editor -> Execute SQL in new tab. This executes the SQL query under the cursor or selected text and creates a new results tab.

To execute the whole script, press Alt+X or click Execute -> Execute SQL Script on the context menu or SQL Editor -> Execute SQL Script on the main menu or in the main toolbar. This executes all queries in the current editor (or selected queries) as a script. DBeaver parses queries one by one using a statement delimiter (“;” by default) and executes them consecutively. For these settings, see the Delimiter preferences section.

To execute the script natively, press Alt+N or click Execute -> Execute SQL Script natively on the context menu or SQL Editor -> Execute SQL Script natively on the main menu or in the main toolbar. Upon activation, a setup wizard is launched, which allows you to configure the parameters for script execution before the script is launched in the native client like PLSQL, MySQL, or SQLPlus. The results are displayed in a text field in the format of console output. It is handy when functions are not supported by DBeaver drivers and require more specialized clients or when the function is weighty, and a faster client is needed.

Note: This function is available for MySQL/Maria, Oracle, and PostgreSQL and may require additional software installation for each database.

To execute a script opening, each query results in a separate tab, press Ctrl+Alt+Shift+X or click Execute -> Execute Statements In Separate Tabs on the context menu or SQL Editor -> Execute Statements In Separate Tabs on the main menu or in the main toolbar. It executes all queries in the script but opens multiple result tabs. Each script query is executed in a separate thread (that is, all queries are executed simultaneously).

Important: Executing a massive script with numerous queries can result in unforeseen problems.

Result tabs

A single query may generate several result sets represented by tabs. These tabs are linked to the query they are executed from.

  • To close an individual tab, press CTRL+Shift+\ or middle-click on a tab header.
  • To close all tabs expect current, click Close all result tabs except this on the context menu of this tab.
  • To close all tabs of the desired query, click Close all result tabs of same query on the context menu of this tab.


A tab is often named after the primary table of your query. For example, after executing the following query you will see a single tab called Album (assuming that your database has a table called Album):


If a query has joins or, in other words, has multiple source tables, a (+) is shown right to the table name. The following query will result in a tab called Album(+):

SELECT * FROM Album al, Artist ar WHERE al.AlbumId = ar.ArtistId;

Additionally, you can change the name of a given tab via its context menu or by using a special comment:

-- title: DBeaver is cool

In other cases, tabs are named in the form of Results <A> (<B>), where:

  • A is an index of query
  • B is an index of the result set of this query


Tabs can be moved around by dragging them with a mouse and pinned using the Pin tab on the context menu of the desired tab. Pinned tabs are stacked on the left. They can be moved among other pinned tabs but can't be mixed with unpinned tabs. Pinned tabs cannot be closed without being unpinned first and cannot be overwritten by executing a query (by making this tab active).


Tabs can be detached from the SQL editor into a separate view using the Detach Tab action found in the context menu of the desired tab. After the tab is detached, you can rearrange and move it anywhere you want (for example, you can put two tabs side-by-side for comparison).

Additionally, you can detach it from the application window using Detach found in the context menu of an already detached tab.

After the tab is detached, it's still synchronized with the SQL editor, meaning you can edit and refresh data as long as the SQL editor that produced that tab is open. Once you close it, tabs become read-only.

SQL Expression Evaluation

To evaluate an SQL expression, right-click the expression and click Execute -> Evaluate SQL expression on the context menu. This command performs a query of SELECT [expression] FROM DUAL type:

Row Count

If you want to know how many rows an SQL query will produce, you need to apply the Row Count feature – highlight and right-click the SQL text and then click Execute -> Select row count on the context menu:

Query Export

It might be useful to export a query if you have a long-running query and you do not need to see its results in the results panel. You can directly export the current query results to a file/table by right-clicking the query and then clicking Execute -> Export From Query on the context menu:

The Data transfer wizard opens. Go through its steps to complete the export of the query.

Parameters and variables

In DBeaver, parameters are used within SQL queries as placeholders, prompting for user input at query execution. Variables, defined with the @set command or through the Variables panel, substitute placeholders with predefined values, enabling scripts to run without manual input each time.

To customize parameter and variable behavior in DBeaver, access the settings through Window -> Preferences -> Editors -> SQL Editor -> SQL Processing.

Setting Description
Enable SQL parameters Allows the use of named parameters within SQL queries.
Anonymous SQL parameters Permits the usage of unnamed parameters, enabling the SQL editor to recognize placeholders denoted by the character specified in the Anonymous parameter mark field.
Anonymous parameter mark Sets the symbol for anonymous parameters (default ?).
Named parameter prefix Defines the prefix for named parameters (default :).
Control command prefix Specifies the prefix for control commands like @set (default @).
Enable parameters in DDL and $$..$$ blocks Permits the use of parameters within DDL statements and $$..$$ code blocks.
Enable variables Activates variable substitution within SQL scripts.

For advanced SQL execution, DBeaver extends functionality with context variables that come from:

  • CLI: Command-line interface variables, which offer a hands-off approach for setting up environments. See the Command-line guide for usage details.
  • Auth properties: Authentication-related variables that enhance security for credential handling, detailed in the Authentication properties documentation.

Variables binding

Define the custom variables with the predefined command or add in the Variables panel.

You can create a variable by using the @set command followed by the variable name and its value. For instance:

@set actor_name = Mark

Once defined, you can include variables in your SQL queries. Use the ${varname} or :varname syntax to insert the value of a variable into the script. For example:

SELECT * FROM public.actor WHERE first_name = '${actor_name}';

Dynamic parameters binding

You can define parameters using the :parameter syntax, turning parts of the query into placeholders for values input at execution. For instance:

SELECT :first_parameter FROM public.actor WHERE first_name = :second_parameter;

Upon every execution of the parameterized query, DBeaver brings up the Bind parameter(s) window.

Field Description
Value Fill in values for each parameter to ensure correct query execution.
Hide parameters set in script If checked, parameters that you have already given values with the @set command will not show up.

Tip: To simplify the process, consider using variables for predefined values before running the script.

Delimiter preferences

To customize delimiter settings in SQL Editor, navigate to Window -> Preferences -> Editors -> SQL Editor -> SQL Processing -> Delimiters.

Setting Options Description
Statements delimiter ; (default) Specifies the character that separates SQL statements.
Ignore native delimiter Checked/Unchecked If checked, ignores any delimiter specified within the script, using the default delimiter from "Statements delimiter" above.
Blank line is statement delimiter Always If set to Always any blank line in the script will serve as a delimiter, separating SQL statements.
Never If set to Never blank lines in the script do not serve as delimiters.
Smart When Smart is selected, the editor checks the following lines to decide whether a blank line should act as a delimiter based on the script's context.
Remove trailing query delimiter Checked/Unchecked If checked, removes the trailing delimiter from SQL statements before they are sent to the server, ensuring cleaner syntax.


  • To select the current query row count, press Ctrl+Alt+Shift+C.
  • To open the definition of the database object currently in focus (under cursor) in a viewer/editor, press F4.

Did we resolve your issue?