When SQL Editor has finished analyzing a partial piece of code, it displays a list of data source objects for you to select from.
SQL Editor takes the following into consideration when analyzing code for a list of possible data source objects for insertion:
● Text to be inserted
● Original text to be replaced
● Content assist request location in original text
● The database object represented by the insertion text
Generally, insertion suggestions use the following format:
<insertion_text > - <qualification_information >
Code assist is available for SELECT, UPDATE, INSERT, and DELETE statements, as well as stored procedures, and functions (built-in and user defined.)
Additionally, code suggestions can be made for DML statements nestled within DDL statements. This functions in the same manner as code assist for statements that are not nestled, and applies to CREATE PROCEDURE, FUNCTION, TRIGGER, TABLE, and VIEW statements.
When the code assist window is open, you can filter out singular object suggestions by pressing (Ctrl + Spacebar). This removes all objects from the assist window while retaining procedures and functions. To display objects again, press (Ctrl + Spacebar) again.
The following table displays a list of all possible object suggestions, and the format in which SQL Editor inserts the suggestions into a statement:
|
|
Note: 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:
|
In addition to DML statements, SQL Editor also suggests objects based on specific fragmented syntax per line of code:
|
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:
1. Click the line that you want SQL Editor to suggest an object for.
2. 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.
Note: 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 Specify Code Assist Preferences on page 16.
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 on page 45 or on the Preferences page, see Specify Data Source Indexing Preferences on page 27.