Comments

Comments let you include arbitrary text within your code to explain what the code does. You can also disable obsolete or unfinished pieces of code by turning them into comments.

PL/SQL supports two comment styles: single-line and multi-line. A double hyphen (- -) anywhere on a line (except within a character literal) turns the rest of the line into a comment. Multi-line comments begin with a slash-asterisk (/*) and end with an asterisk-slash (*/). For more information, see "Comments".

Syntax

comment ::=

Description of comment.gif follows
Description of the illustration comment.gif

Usage Notes

While testing or debugging a program, you might want to disable lines of code. Single-line comments can appear within a statement at the end of a line. You can include single-line comments inside multi-line comments, but you cannot nest multi-line comments.

You cannot use single-line comments in a PL/SQL block that will be processed dynamically by an Oracle Precompiler program. End-of-line characters are ignored, making the single-line comments extend to the end of the block. Instead, use multi-line comments. You can use multi-line comment delimiters to comment-out whole sections of code.

Examples

For examples, see the following:


Example 2-4, "Using Single-Line Comments"
Example 2-5, "Using Multi-Line Comments"
Example 13-1, "Declaring and Assigning Values to Variables"