Sql*Plus User’s Guide and Reference


-8 SQL*Plus User's Guide and Reference Using --


Download 5.34 Mb.
Pdf ko'rish
bet63/103
Sana04.08.2023
Hajmi5.34 Mb.
#1665146
1   ...   59   60   61   62   63   64   65   66   ...   103
Bog'liq
E18404-12

5-8
SQL*Plus User's Guide and Reference
Using --
You can use ANSI/ISO "--" style comments within SQL statements, PL/SQL blocks, or 
SQL*Plus commands. Since there is no ending delimiter, the comment cannot span 
multiple lines.
For PL/SQL and SQL, enter the comment after a command on a line, or on a line by 
itself:
-- Commissions report to be run monthly
DECLARE --block for reporting monthly sales
For SQL*Plus commands, you can only include "--" style comments if they are on a 
line by themselves. For example, these comments are legal:
-- set maximum width for LONG to 777
SET LONG 777
This comment is illegal:
SET LONG 777 -- set maximum width for LONG to 777
If you enter the following SQL*Plus command, SQL*Plus interprets it as a comment 
and does not execute the command:
-- SET LONG 777
Notes on Placing Comments
SQL*Plus does not have a SQL or PL/SQL command parser. It scans the first few 
keywords of each new statement to determine the command type, SQL, PL/SQL or 
SQL*Plus. Comments in some locations can prevent SQL*Plus from correctly 
identifying the command type, giving unexpected results. The following usage notes 
may help you to use SQL*Plus comments more effectively:
1.
Do not put comments within the first few keywords of a statement. For example: 
CREATE OR REPLACE
2 /* HELLO */
3 PROCEDURE HELLO AS
4 BEGIN
5 DBMS_OUTPUT.PUT_LINE('HELLO');
6 END;
7 /
Warning: Procedure created with compilation errors.
The location of the comment prevents SQL*Plus from recognizing the command as 
a command. SQL*Plus submits the PL/SQL block to the server when it sees the 
slash "/" at the beginning of the comment, which it interprets as the "/" statement 
terminator. Move the comment to avoid this error. For example:
CREATE OR REPLACE PROCEDURE
2 /* HELLO */
3 HELLO AS
4 BEGIN
5 DBMS_OUTPUT.PUT_LINE('HELLO');
6 END;
7 /
Procedure created.


Placing Comments in Scripts
Using Scripts in SQL*Plus

Download 5.34 Mb.

Do'stlaringiz bilan baham:
1   ...   59   60   61   62   63   64   65   66   ...   103




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling