PL/SQL User's Guide and Reference Release 2 (9.2) Part Number A96624-01 |
|
PL/SQL Language Elements, 9 of 52
Comments describe the purpose and use of code segments and so promote readability. PL/SQL supports two comment styles: single-line and multi-line. Single-line comments begin with a double hyphen (- -
) anywhere on a line and extend to the end of the line. Multi-line comments begin with a slash-asterisk (/*
), end with an asterisk-slash (*/
), and can span multiple lines. For more information, see "Comments".
Comments can appear within a statement at the end of a line. However, you cannot nest comments.
You cannot use single-line comments in a PL/SQL block that will be processed dynamically by an Oracle Precompiler program because end-of-line characters are ignored. As a result, single-line comments extend to the end of the block, not just to the end of a line. Instead, use multi-line comments.
While testing or debugging a program, you might want to disable a line of code. The following example shows how you can "comment-out" the line:
-- UPDATE dept SET loc = my_loc WHERE deptno = my_deptno;
You can use multi-line comment delimiters to comment-out whole sections of code.
The following examples show various comment styles:
-- compute the area of a circle area := pi * radius**2; -- pi equals 3.14159 /* Compute the area
of a circle. */ area := pi * radius**2; /* pi equals 3.14159 */
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|