You can validate the syntax of SQL statements
and XQuery statements in the SQL and XQuery editor. You also can validate
the table, column, and stored procedure references in SQL statements.
You
can validate existing SQL and XQuery statements when you open the
script that contains the statements in the SQL and XQuery editor.
You also can validate SQL and XQuery statements while you are creating
them or editing them in the editor.
Before you begin
- To control whether validation occurs when you open an existing
script in the SQL and XQuery editor, set the validation options on
the SQL and XQuery Editor page in the Preferences window
().
- The script that contains the SQL and XQuery statements that you
want to validate must be open in the SQL and XQuery editor.
About this task
The syntax in SQL statements and XQuery statements is
validated by parsing the statements to determine whether keywords
and their location in the statements are valid. By default, parsing
is based on the type of database that the script is connected to.
You can change the parser to use for validation; for example, if you
plan to export a script for use in another supported database. If
you have disconnected a script from its database, you can select the
parser to use for validation.
Table, column, and stored procedure
references are validated only in SQL DML statements. The validation
process determines whether the following conditions are met:
- Tables that are referenced in the SQL statements exist in the
connected database
- Referenced columns exist in the table that they are associated
with
- Stored procedures that are called in the SQL statements exist
in the connected database
Procedure
To validate SQL statements and XQuery statements in the
SQL and XQuery editor:
- Optional: If you want to validate statements
based on a specific database type that does not match the type used
for your connection, change the parser to use for validation:
- Open the Validation tab.
- Select a validation option.
- To validate the syntax of the statements, right-click in
the editor, and then select a validation option.
- To validate the syntax of the statements for the connection
that is selected in the Configuration tab, select the Validate
statement syntax for current configuration option.
- To validate the syntax of the statements for a different data
server type, select the Validate statement syntax option.
Then, select a data server type from the list.
- Optional: To validate table, column, and stored
procedure references in the SQL DML statements in the script, do one
of the following actions:
- Open the Validation tab, and then select
the Validate database object references check
box.
- Right-click in the editor, and then select Validate
Database Object References.
Results
Validation errors are shown in the SQL and XQuery editor marker
bar.