Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with the Oracle comments syntax

634346Apr 16 2008 — edited Apr 16 2008
Dear All members of Oracle forum,
The problem is select query is executing twice in my script, eventhough i have written only one. hear u can see what i did.

1. create one .sql file with the below content.
select sysdate from dual;
/*its a comment */
select sysdate from dual;
2. goto Oracle sql*plus editor and execute the above .sql file.
3. Ideally it should show the date output only 2 times. But, if you run it, it will show thrise(3 times).
4. but if we modify the above .sql file like below, it will show the date only tice(2 times).

select sysdate from dual;
/* its a comment */
select sysdate from dual;
the difference between the twwo scripts is, i have given one space betwen first '*' sysmbol and the first word of the comment (i,e its word).

Can somebody explain what Oracle is doing in first case, and why it is printing 3 times, eventhough the select query is only twice.

warm regards
Murali
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 14 2008
Added on Apr 16 2008
5 comments
588 views