Execute statements in a database console
When you create a data source, a database console is created automatically. For more information about database consoles, see Database consoles.
In the Database tool window (View | Tool Windows | Database), click the data source.
Open F4 or create (Ctrl+Shift+F10 | New Console) a database console. For more information about working with consoles, see Working with consoles.
Type or paste the statement that you want to execute.
Press Ctrl+Enter. Alternatively, click the Execute icon on the toolbar.
If you have several statements, select whether you want to execute all statements or a single statement. The suggestion list always contains an item for running all the statements.
Executing parameterized statements
If you have parameters in your statement, you must specify the values of the parameters before you execute the statement.
To execute a parameterized statement, click the Execute button on the toolbar and enter values in the second column. Alternatively, to open the Parameters dialog, click the View Parameters button .
Execute a group of statements
To execute a group of statements, select the necessary statements and click the Execute button .
Execute all statements in a console
To execute all the statements in a console, use the Run '<console_name>' command (as an alternative to the Execute command).
Right-click the console tab or any area in the console and select Run '<console_name>'.
The Run '<console_name>' command has the following restrictions:
Statements with parameters are skipped.
Retrieved data for the
SELECTstatements are not shown.
Execute a part of a statement
To execute a part of a statement (for example, a subquery), select the fragment that you want to execute and click the Execute button .
View history of executed statements
CLion stores history of all statements that you have run.
To open the History dialog, click or press Ctrl+Alt+E.
To filter information, start typing your search query.
To paste the query from the History dialog to the console, double-click the query in the left pane of the History dialog.
To delete a record from history, select the record and press Delete.
Stop running statements
To terminate execution of the current statement or statements, click the Disconnect button or press Ctrl+F2.
Save the result of a SELECT statement into a file
Select Execute to File and select the output format.
Specify the file location and name.
Edit data in INSERT statements as a table
INSERTstatements that you want to edit.
Right-click the selection and click Edit as Table.
Run stored procedures
A stored procedure is a set of SQL statements with an assigned name.
Right-click a stored function that you want to execute.
In the Execute Routine window, type all the necessary parameter values, and click OK.
Enable output from the DBMS_OUTPUT package (Oracle)
In Oracle, the DBMS_OUTPUT package enables you to send messages from stored procedures, packages, and triggers. You can enable or disable showing the contents of the DBMS_OUTPUT buffer in the output pane. To toggle the DBMS_OUTPUT option, click the Enable SYS.DBMS_OUTPUT button on the toolbar of the Services tool window.