Page History
...
Object and Stored Procedure Suggestions
Object Suggestion | Syntax/Example |
---|---|
Table | (TABLE) [catalog].[schema] EMPLOYEE - (TABLE)HR |
Alias Table | (TABLE ALIAS) [catalog].[schema]tableName EMPLOYEE - (TABLE ALIAS)HRJOBS |
Column | datatype - (Column) [catalog].[schema].tableName JOB_TITLE:varchar(20) - (Column)HRJOBS |
Alias Column | datatype - (COLUMN ALIAS) [catalog].[schema].tableName.columnName JOB_TITLE:int-(COLUMN ALIAS)HR.JOBS.JOB_ID |
Schema | (SCHEMA) [catalog] dbo-(SCHEMA)NorthWind |
Catalog | (CATALOG) |
Call | Call HR.ADD_JOB_HISTORY |
Function Suggestions
Function Suggestion | Syntax/Example |
---|---|
Built-in | SELECT A FROM HR.DEPARTMENTS WHERE HR.DEPARTMENTS AVG |
User-Defined | SELECT + FROM HR.CLIENTS WHERE HR.F_PERSONAL |
Info |
---|
Function suggestions are only available for Oracle and DB2 platforms. |
SQL Editor detects incomplete or erroneous code, processes the code fragments, and then attempts to apply the appropriate logic to populate the code.
As code is typed into SQL Editor, the application ‘reads’ the language and returns suggestions based on full or partial syntax input.
Depending on the exact nature of the code, the automatic object suggestion feature behaves differently; this enables SQL Editor to provide reasonable and ‘intelligent’ suggestions on coding.
Additionally, semantic validations can be made for DML statements nestled within DDL statements. This functions in the same manner as validation for top-level statements, and applies to CREATE PROCEDURE, FUNCTION, TRIGGER, TABLE, and VIEW statements.
The following chart displays the possible statement fragments that SQL Editor will attempt to suggest/populate with objects:
Statement Fragment Elements | Object Suggestion Behavior |
---|---|
SELECT | A list of tables, when selected automatically, prompts the user to select a column. |
UPDATE and DELETE | A list of tables appears in the FROM and/or WHERE clause. |
INSERT | A list of tables and views appears in the INSERT INTO and OPEN BRACKET clause prior to values. A list of columns based on the table or view name appears in the OPEN BRACKET or VALUES clause. |
In addition to DML statements, SQL Editor also suggests objects based on specific fragmented syntax per line of code:
Statement Syntax | Object Suggestion Behavior |
---|---|
A partial DML statement (for example SEL ... indicates a fragment of the SELECT clause) | The keyword is completed automatically, assuming SQL Editor can match it. Otherwise, a list of suggested keywords is displayed. If the preceding character is a period, and the word prior is a table or view, a list of columns appears. If the word being typed is a part of a table name (denoted by a schema in front of it) the table name is autocompleted. If the word being typed has a part of a column name (denoted by a table in front of it) the column name is autocompleted. |
Without typing anything. | A list of keywords appears. |
A period is typed. | If the word prior to the period is a name of a table or view, a list of columns is displayed. If the word prior to the period is a schema name, a list of table names is displayed. If the word prior to the period is either a table name or a schema name, then both a list of columns and a list of table names is displayed |
To activate code suggestions:
By default, code suggestions are automatically offered if you stop typing in SQL Editor for one second. You can turn off the automated suggestion feature on the Code Assist preferences page.
If automated code suggestion is disabled, you can still access the suggestion window using the following method: 1Click
- Click the line that you want SQL Editor to suggest an object for.
...
- Press (CTRL+Spacebar) on your keyboard. SQL Editor 'reads' the line and presents a list of tables, views or columns as appropriate based on statement elements.
...
Info |
---|
On a per platform basis, auto-suggestion behavior may vary. (For example, the WITH statement on DB2 platforms.) |
To modify object suggestion parameters, including setting it from automatic to manual, see
see Specify Code Assist Preferences.
You can speed up the performance of the code assist functionality by enabling data source indexing either when you connect to the data source, see Working with Data Sources or on the Preferences page, see Specify Data Source Indexing Preferences.
Anchor | ||||
---|---|---|---|---|
|
...
Understanding Hyperlinks
SQL Editor supports hyperlinks that are activated when a user hovers their mouse over a word and presses the CTRL key. If a hyperlink can be created, it becomes underlined and changes color. When the hyperlink is selected, the creation script for the hyperlink object is opened in a new editor.
Hyperlinks can be used to link to tables, columns, packages, and other reference objects in development code. Additionally, hovering over a hyperlink on a procedure or function of a call statement will open it. You can also use the hyperlink feature on function calls in DML statements.
Clicking a hyperlink performs an action. The text editor provides a default hyperlink capability. It allows a user to click on a URL (for example, https://www.idera.com) and database object links.
Hyperlink options (look and feel) can be modified via the Hyperlinking subnode in the Editors > Text Editors node of the Preferences panel. NOTE:
Info |
---|
Hyperlink functionality relies on certain objects being captured in the Object Index. If the index is turned off, or has been restricted in what information it captures, users will be unable to link them (as they are non-existent within the Index.) To specify object index types, |
...
Anchor | ||||
---|---|---|---|---|
|
...
Understanding Code Formatting
Code formatting provides automatic code formatting in SQL Editor while you are developing code.
To access the code formatter, select the open editor you want to format and select Ctrl+Shift+F. The code is formatted automatically based on formatting parameters specified in the Code Formatter subnode of the SQL Editor node in the Preferences panel.
You can also format an entire group of files from Project Explorer. To do so, select the directory or file and execute the Format command via the shortcut menu. The files will be formatted automatically based on your formatting preferences. See Specify Code Formatter Preferences for more information.
The following examples display a list of code formatting parameters and the resultant output in SQL Editor, based on the same set of SQL statements.
Custom Code Formatting Example 1
The following chart indicates a list of custom code formatting parameters and their corresponding values. The chart is followed by the actual syntax as it would appear in SQL Editor, based on the formatting parameter values.
Compare the parameters and formatted code in Example 2 with this example for a concept of how custom formatting works.
...