Query Pane: Working with Queries
After connecting to a database, an SQL script can be entered in the SQL Editor and executed. This section describes:
•How an SQL script is entered in the SQL Editor.
•How the script is executed in the Database Query window.
The following icons are referred to in this section:
Executes currently selected SQL statement. If script contains multiple statements and none is selected, then all are executed.
Execute for Data Editing
Same as for Execute command, except that results (in Results tab) are editable.
Import SQL File
Opens an SQL file in the SQL Editor.
Creating SQL statements and scripts in the SQL Editor
The following GUI methods can be used to create SQL statements or scripts:
•Drag and drop: Drag an object from the Browser pane into the SQL Editor. An SQL statement is generated to query the database for that object.
•Context menu: Right-click an object in the Browser pane and select Show in SQL Editor | Select.
•Manual entry: Type SQL statements directly in SQL Editor. The Auto-completion feature can help with editing.
•Import an SQL script: Click the Import SQL File icon in the toolbar of the Database Query window.
Executing SQL statements
If the SQL script in the SQL Editor has more than one SQL statement, select the statement to execute and click either the Execute icon or Execute with Data Editing icon in the toolbar of the Database Query window. If no statement in the SQL script is selected, then all the statements in the script are executed. The database data is retrieved and displayed as a grid in the Results tab. If Execute with Data Editing was selected, then the retrieved data in the Result Grid can be edited. Messages about the execution are displayed in the Messages tab.