Home » SQL & PL/SQL » SQL & PL/SQL » Problem with the Oracle Comment's syntax (merged 2 threads)
Problem with the Oracle Comment's syntax (merged 2 threads) [message #314272] Wed, 16 April 2008 04:50 Go to next message
muralimadhavuni
Messages: 26
Registered: November 2005
Location: HYD
Junior Member
Dear All members of Ora-faq,
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

[Updated on: Wed, 16 April 2008 05:05] by Moderator

Report message to a moderator

Re: Problem with the Oralce Comment's sysntax [message #314278 is a reply to message #314272] Wed, 16 April 2008 05:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How is this an expert question?

It is clearly stated in the forum description: "Newbies should not post to this forum!"
Expert notion is defined in the sticky: Not an EXPERT? Post in the NEWBIES forum, NOT here
Rules are described in: OraFAQ Forum Guide
Read them, follow them including what is said about formatting.

As you are an expert, I don't answer the question because you obviously already knows it.

Regards
Michel
Re: Problem with the Oralce Comment's sysntax [message #314296 is a reply to message #314272] Wed, 16 April 2008 05:34 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL*PlusŪ User's Guide and Reference
Chapter 5 Using Scripts in SQL*Plus
Section Placing Comments in Scripts
Subsection Using /*...*/
Quote:
You must enter a space after the slash-asterisk(/*) beginning a comment.


Chapter 12 SQL*Plus Command Reference
Section / (slash)
Quote:
Executes the most recently executed SQL command or PL/SQL block which is stored in the SQL buffer.


Regards
Michel
Previous Topic: How do I create a mat view with zero length columns ?
Next Topic: UTL_FILE Line Length Problem
Goto Forum:
  


Current Time: Sat Dec 03 09:57:11 CST 2016

Total time taken to generate the page: 0.06795 seconds