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.
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 the Execute 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. Messages about the execution are displayed in the Messages tab.