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

Home -> Community -> Usenet -> c.d.o.misc -> Re: An interest situation using "&" in PLSQL comment line

Re: An interest situation using "&" in PLSQL comment line

From: Mark D Powell <mark.powell_at_eds.com>
Date: 11 Jun 2002 06:42:09 -0700
Message-ID: <178d2795.0206110542.5c73ab8@posting.google.com>


C Chang <cschang_at_maxinter.net> wrote in message news:<3D058057.2B35_at_maxinter.net>...
> When I added a new private function to the package body, I put a comment
> line at the top like :
> -- This is a function to use ID to search D&B number
> FUNCTION..
>
> However, when I compiled the package body, the compiler asked "the value
> for b:"
> After I entered a number say 5, the compiler responded with
> old 13: -- This is a function to use ID to search D&B number
> new 13: -- This is a function to use ID to search D5 number
> then compile successfully.
> Why the comment line with &B will replace the 5 that I entered? my
> ORacle PL/SQL book does not mention any about this. I thought using the
> "-- ..", compiler is supposed to ignore the line. Does any one know
> this?
>
> C Chang

I was going to say this was documentated behavior since I have known this since version 6; however, when I went to check to see if you could escape the '&' in a quick test Oracle ignored the '&' in a comment. So on version 8.1.7 it appears SQLPlus now is aware of when '&' variables are declared in commented out lines.

UT1> @test4
UT1> set echo on
UT1> set verify on
UT1> --
UT1> -- input variable &var1
UT1> -- input variable \&var2
UT1> --
UT1> select to_char(to_date('&var3','yyyymmdd'),'MONTH DD YYYY') from
dual;
Enter value for var3: 20020612
old 1: select to_char(to_date('&var3','yyyymmdd'),'MONTH DD YYYY') from dual
new 1: select to_char(to_date('20020612','yyyymmdd'),'MONTH DD YYYY') from dual

TO_CHAR(TO_DATE('



JUNE 12 2002 Who knows with what version this behavior changed? Received on Tue Jun 11 2002 - 08:42:09 CDT

Original text of this message

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