Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus in-line comments problem...
mdeblis_at_hotmail.com (Mike Deblis) writes:
> I'm, using SQL*Plus 9.0.1.0.0 on Solaris 2.8 and am having a slight
> problem...
>
> The docs seem to suggest that you can have a comment at the end of a
> line thus:
>
> DROP TABLE fred; -- Delete the table
The 9.0.1 doc states that you cannot have comments after the final semicolon. See #2 in "Notes on Placing Comments" in the 9.0.1 SQL*Plus UG&R:
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a88827/ch33.htm#1008878
> However, when I have this is a script read by:
>
> sqlplus /@db <<EOF
> @mycript.sql
> quit
> EOF
>
> lines with trailing comments seem to be ignored. Am I doing something
> stupid (I presume I am).
The lines are probably being ignored. Using a script is the same as entering command at the prompt; if a single statement is followed by a blank line then SQL*Plus thinks you have made a mistake and don't want the statement run. The statement will still be put into the SQL buffer and you can use 'LIST' to view it, and '/' or 'RUN' to execute it. See also SET SQLBLANKLINES at:
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a88827/ch840.htm#82094
Chris
-- Christopher Jones, Oracle Corporation, Australia.Received on Mon Aug 12 2002 - 20:16:30 CDT