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 'escape" Ampersand (&) on insert into table

Re: How to 'escape" Ampersand (&) on insert into table

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 25 Jun 1998 14:27:31 GMT
Message-ID: <35955df2.6329000@192.86.155.100>


A copy of this was sent to "michael t hudacko" <hudacko_at_bbdo.com> (if that email address didn't require changing) On 25 Jun 1998 13:43:46 GMT, you wrote:

>Need ideas. Trying to make OracleDB "ignore" the ampersand within a string
>of characters...
>I thought I could double-up the single quotes... doesn't seem to work. I
>need to provide logic to
>3GL programmer whose objective is to break up a text file into key fields
>which WILL CONTAIN AMPERSANDS!
>
>Example a table named "Test" has one field defined VARCHAR2(2000)
>
>Insert into Test Values ('Bugs & Daffy');
>this statement translates as substitution variable Daffy.
>
>Insert into Test Values ('Bugs'||'&'||'Daffy');
>this statement gets the job done. Field String_Field contains:
>'Bugs&Daffy'
>
>
>Thanks In Advance

The & is a SQL*Plus thing, not SQL in general. Your 3gl programmer won't have any issues with the & (in OCI or Pro*C, the & doesn't mean anything).

In sqlplus it is used to define 'macro' variables....

You can turn it off by

SQL> set scan off
or
SQL> set define off
or
SQL> set define <some other character>

for example...  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Jun 25 1998 - 09:27:31 CDT

Original text of this message

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