SQL Templates
Table of contents
Overview
Templates let you quickly insert commonly used SQL statements into an SQL script.
To view available templates, press Ctrl+Alt+SPACE (⌃+⌥+SPACE on macOS) or right-click within the script panel and select SQL Template from the context menu. A list of available templates will appear:
To apply a template in the SQL Editor, in the script pane:
- Type the template name and press Tab.
- Right-click where you want to insert a template, select SQL Template from the context menu, and double-click the
template name from the list.
The SQL statement will be inserted into the script.
To edit, add, or remove templates, click the Configure icon in the bottom toolbar, then go to Preferences -> SQL Editor -> Templates.
Tip: For more information on managing templates, see Eclipse documentation.
Standard Eclipse templates
Variable | Description |
---|---|
${cursor} | Specifies the cursor position when the template edit mode is left. This is useful when the cursor should jump to a different place than to the end of the template upon leaving the template edit mode. |
${year} | Takes the current year value. |
${date} | Takes the current date value. |
${time} | Takes the current time value. |
${dollar} | Takes the dollar sign $. Alternatively, two dollar signs can be used: $$. |
${user} | Takes the user name. |
${word_selection} | Takes the content of the current text selection. |
${line_selection} | Takes content of all currently selected lines. |
DBeaver specific templates
Variable | Description |
---|---|
${schema} | Takes the current schema name. |
${catalog} | Takes the catalog name. |
${table} | Takes the current table name (from the active catalog/schema). |
${column} | Takes the column name (from the current table). |