Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to disable '@' in SQL*Plus?

Re: How to disable '@' in SQL*Plus?

From: Bricklen <bricklen-rem_at_yahoo.comz>
Date: Thu, 29 Jan 2004 15:22:38 GMT
Message-ID: <2z9Sb.28348$5D.21416@clgrps13>


Anthony wrote:

> Thanks Daniel for the reply.
>
> Do you mean that it is impossible to disable this behaviour?
>
> As far as I know, the DB does not interpert the '@' specially in this
> case. It is SQLPlus which treat it as a special command. And surely
> Oracle will allow a reserved word in a string.
> (I would think that the '@' was considered reserved word because of
> its use in db link. But not sure...)
>
> BTW, I don't think having a '@' in a the start position of a line in
> multi-line string indicates a bad design...
>
> Actually, similar problem also arise for the following case:
>
> (test.sql)
> create or replace PACKAGE MyPackage IS
> PROCEDURE MyProcedure(MyParam1 IN VARCHAR2) ;
> /*
> Do something.
> @param MyParam1 First Parameter
> */
> END MyPackage;
> /
>
> (In SQL*Plus)
> SQL> @C:\test.txt
> SP2-0310: unable to open file "param.sql"
>
> Package created.
>
> (I would agree that there may be an issue on programming style here.)
>

You have a few issues here:
if it is for SQL*Plus only, type
set escape \

then your code can run:
select '
\@a
'
from dual;

or just run it as a single line, like
select '@a' from dual;
so there is no need to escape it.

If you are just using the @ symbol inside of comments, then try it like this:

create or replace PACKAGE MyPackage IS

   PROCEDURE MyProcedure(MyParam1 IN VARCHAR2) ;

	/*
   	Do something.
		-- @param MyParam1 First Parameter
	*/

END MyPackage;
/

with the "--" preceding the @ symbol.

That's all that I can think of offhand. I also wouldn't recommend putting suspect code like that into production, but that's totally up to you. Received on Thu Jan 29 2004 - 09:22:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US