Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: & symbol in PL/SQL
Why complain about something that has always been this way? Just set define
off, run your code, and turn define back on.
UT1 > set define off
UT1 > select '&one' from dual;
'&ON
UT1 > set define &
UT1 > /
Enter value for one: 1
old 1: select '&one' from dual
new 1: select '1' from dual
'
-
1
HTH -- Mark D Powell --
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Hand, Michael T
Sent: Wednesday, August 11, 2004 1:01 PM
To: Oracle List (E-mail 2)
Subject: & symbol in PL/SQL
I don't write much PL/SQL as so it took many years before I ran into this one. Pardon me is this is well known. Tested in 7.3.4 \& 9iR2
SQL> show define
define "&" (hex 26)
SQL> -- Comment line with & symbol in it
SQL> declare
2 c varchar2(1);
3 begin
4 select 'R' into c from dual;
5 -- comment line with a & symbol in it
6 -- comment line with a \& symbol escaped
7 dbms_output.put_line(c);
8 end;
9 /
Enter value for symbol: e
old 5: -- comment line with a & symbol in it
new 5: -- comment line with a e in it
R
PL/SQL procedure successfully completed.
Why does the PL/SQL parser interpret the define symbol before comment
delimeters? So one can't comment out a line of PL/SQL code containing
a & without also using the escape? And worst of all, I can't use the
& as shorthand for AND in my embedded comments. Open a TAR. Call out
the National Guard.
Mike Hand
Polaroid Corp.
-- This transmission is intended only for use by the addressee(s) named herein and may contain information that is proprietary, confidential and/or legally privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html ----------------------------------------------------------------- ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Wed Aug 11 2004 - 12:05:36 CDT
![]() |
![]() |