While you are writing SQL statements in the SQL and XQuery
editor, you can quickly comment out SQL code by using a command on
the pop-up menu. You can use the same command to quickly uncomment
SQL code.
Before you begin
The SQL script must be open in the SQL and XQuery editor.
About this task
You can comment out or uncomment a single line of code
in an SQL statement, multiple adjacent lines of code, a complete SQL
statement, or multiple adjacent SQL statements.
The syntax for
a comment in a line of SQL code is a double hyphen (--)
at the beginning of the line. The comment affects all of the SQL code
in the line.
Note: This process does not try to merge a new comment
with an existing comment. For example, if you comment out line 4 in
an SQL statement, and then later comment out the complete SQL statement,
line 4 will then have double comment notation (that is, two sets of
double hyphens in positions 1 through 4 of the line). If you uncomment
the complete SQL statement, line 4 will still be commented out.
Procedure
To
comment out or uncomment SQL code in the SQL and XQuery editor:
- Select the SQL code that you want to comment out or uncomment.
- For a single line, click anywhere in the line of code.
- For multiple lines, drag the pointer through the lines of
code.
- Right-click the selected SQL code, and then select Toggle
Comment.
Results
The results of this process depend on the original state of
the selected SQL code:
- For a single line of code:
- If the line was active, the line is now a comment.
- If the line was a comment, the line is now active.
- For multiple lines of code:
- If any of the lines were active, all of the lines are now comments.
Note that lines that were previously comments now have double comment
notation.
- If all of the lines were comments, all of the lines are now active