The SQL Editor is a Workbench interface component that enables the development, viewing, and formatting of SQL code.
The Editor supports the following the functionality
- Code assist:
- Code complete. Type Ahead and Name completion. For more information, see Understanding Code Assist.
- Code templates. Templates for creation of tables, procedures, etc. For more information, see Understanding SQL Templates.
- Hyperlinks. For more information, see Understanding Hyperlinks.
- Semantic validation. For more information, see Semantic Validation.
- Object hovering. Hover over an error found and an explanation of the cause of the error appears.
- Code formatter. For more information, see Understanding Code Formatting.
- Code correction and transformations. For more information, see Examples of transformations and SQL query rewrites.
- Object indexing. For more information, see Specify Data Source Indexing Preferences.
- SQL Project Explorer. For more information, see Working with SQL projects.
SQL Editor contains context-sensitive command menus that are tailored with pertinent functionality for the specified file format.
If SQL Editor does not recognize a selected file format, DB Optimizer automatically launches the file externally in the system default application. External editors are not embedded in the Workbench. For example, on most machines, the default editor for HTML files is the system Web browser. SQL Editor does not, by default, recognize HTML files, and opening an HTML file from the Workbench launches the file in an instance of the Web browser instead of the Editor.
Any number of instances of SQL Editor can be open on the Workbench at the same time. Multiple instances of SQL Editor displaying different content may be open in the same Workbench. These instances will be stacked by default, but can also be tiled side-by-side so the content of various files can be viewed simultaneously for comparison or multi-tasking purposes. When an instance of SQL Editor is active, the Workbench Main Menu automatically contains commands applicable to the file format. If a view is active, SQL Editor commands are disabled automatically, except when commands are still valid between the selected view and the file displayed in the interface.
Sematic Validation
When working with code in SQL Editor, the window contains a number of features that provide an increase in the efficiency and accuracy of code development. The following syntax highlighting changes are automatically applied to code as a user adds lines in the interface.
Code | Formatting |
---|---|
Comments | Green font, italics SQL |
Commands | Dark blue font Coding |
Errors | Red underline |
Strings | Red font |
Non-Executable Command Line Comma | Aqua font |
Single-line and multiple-line comments appear in different colors.
Furthermore, SQL Editor provides two column bars, one on either side of the code window. The purple change bar in the left-hand column indicates that the line of code has been modified. Hover over the change bar to display the original code text. The red square in the right-hand column indicates that there are errors in the code window. Hover the mouse over the square to view the error count. Click the red bar in this column to navigate directly to the line in which the SQL Editor detects the error. SQL Editor automatically highlights the appropriate code. Non- executable command line commands are displayed in a different formatting style than SQL commands. Syntactic and semantic errors are also highlighted.
SQL Editor also features dynamic error detection, object lookup and suggestion features, code folding, and auto-formatting. SQL Editor is able to identify different areas in a statement, and enables users to retrieve subclauses, resolve table aliases, and dynamically return lists of tables, views, and columns, as needed.
See also Working in SQL Editor.