RE: & symbol in PL/SQL

  • From: "Mercadante, Thomas F" <thomas.mercadante@xxxxxxxxxxxxxxxxx>
  • To: "'oracle-l@xxxxxxxxxxxxx'" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 11 Aug 2004 13:08:47 -0400

Mike,

You are correct.  Whenever I process PL/SQL (like I'm installing developers
stuff) I issue a set define ~ command to change the standard behavior.  I
don't really think this is a PL/SQL problem, but a SqlPlus problem.  You can
run the same script thru, say Toad, and it works fine - and the & character
gets stored within the package (like a stored package) perfectly fine.
SqlPlus is doing the dirty deed.

Hope this helps.

Tom Mercadante
Oracle Certified Professional


-----Original Message-----
From: Hand, Michael T [mailto:HANDM@xxxxxxxxxxxx] 
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@xxxxxxxxxxxxx put
'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: