About Editing Oracle SQL Scripts
This section describes the Oracle SQL Script Editor, including the following topics:
About Oracle SQL Script Editor
The Oracle SQL Script Editor is a file-based editor for SQL scripts that use Oracle syntax. Along with editing functionality, it supports keyword coloring, F1 help, and the ability to run scripts. It should be noted that there is a generic SQL script editor with Visual Studio, however, this editor does not process Oracle SQL Script files. The Oracle SQL Script editor should be used instead.
Setting the Oracle SQL Script Editor as the Default Editor
In the context of an Oracle Database Project Version 2, scripts are always opened using the Oracle SQL Script Editor.
However, for external SQL files, the Microsoft SQL Editor opens .sql
files. It does not support Oracle SQL syntax and does not use the SQL*Plus engine to execute scripts.
Therefore, for external SQL files, and also, in case a configuration setting is set incorrectly, you should set the Oracle SQL Script Editor to be the default for .sql
files. You can do this the time you open a .sql
file as follows:
If the .sql script is in the Oracle Database Project Version 2, you can set the default by selecting the script, then choosing Open With, selecting Oracle SQL Script Editor and clicking Set as Default.
For external SQL files, use the Visual Studio File Menu, Open, File, select the desired SQL file, then click the arrow next to Open button and select Open With then select Oracle SQL Script Editor, Set as Default and click Ok.
As it is easy to launch the wrong SQL editor, you can verify that you are using the Oracle SQL Script Editor by right-clicking and comparing your menu items to this list: Menu Options.
See Oracle SQL Script Compatibility Requirements for details on compatibility.
Launching the Oracle SQL Script Editor
The Oracle SQL Script Editor can be launched in the following ways:
-
In the Oracle Database Project Version 2, double-click the script file or select it and press Enter
-
Open With from the project node menu
Editing Script Files
Once script files are opened, you can edit them in the Oracle SQL Script Editor, which supports keyword coloring, and F1 help. Oracle Database Project Version 2 script files follow the convention of one CREATE statement per SQL file per schema object. Any additional SQL statements beyond a single CREATE statement will be ignored. See the errors and warnings window of Visual Studio and the Visual Studio output window for notifications of this.
When you right-click the Oracle SQL Script Editor, menu options appear.
Menu Options
When source control is enabled, this menu will also contain applicable source control operations.
Menu Option | Description |
---|---|
Run |
Runs the script using the default database reference. If there is no default database reference, then Run works the same as Run On.The results appear in the Output Pane. If there is a script running, then this menu item does not appear. You can only use Oracle SQL Script Editor to run scripts opened from an Oracle Database Project Version 2. See Running a Script from Oracle Database Project Version 2. |
Run Selection |
Runs the selected text using the default database reference. If there is no default database reference, then Run Selection works the same as Run On, except only the selected text runs. The results appear in the Output Pane. If there is no selected text, or if there is a currently running query, then this menu item is disabled. See Running a Script from Oracle Database Project Version 2. |
Cut |
Copies selected text to the clipboard, and removes it from the script. |
Copy |
Copies selected text to the clipboard. |
Paste |
Pastes text from the clipboard into the script. |
Cancel |
Cancels the currently running script. If there is no script running, then this menu option does not appear. |
Delete |
Deletes the selected text. |