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 can insert '&' in my string?

Re: How can insert '&' in my string?

From: Ken <kingram_at_sdl.org>
Date: 1998/02/25
Message-ID: <34F4B19F.74C6805@sdl.org>#1/1

There appear to be many creative solutions. I have found the simplest solution to be:

set define < (or some other rarely used character)

This is a rarely used character in SQL*Plus when I'm using it, and it doesn't require completely disabling substitution.

Adrian Shepherd wrote:
>
> Try
>
> insert into test vales 'Bread'||'&'||'butter'
>
> Had the same problem just yesterday...
>
> AMARENDRA B NETTEM wrote in message
> <34EC817E.70AD6519_at_charlie.cns.iit.edu>...
> >Hi,
> >Try this
> >
> >SQL> SET ESCAPE ON
> >SQL> INSERT INTO TEST VALUES('X\&Y');
> >-----------------------------------------------------------
> >
> >SQL>DESC TEST
> > Name Null? Type
> > ------------------------------- -------- ----
> > VALUE VARCHAR2(10)
> >
> >SQL>SET ESCAPE ON
> >
> >SQL>SHOW ESCAPE
> >escape "\" (hex 5c)
> >
> >SQL>INSERT INTO TEST VALUES('X\&Y');
> >
> >1 row created.
> >
> >SQL>SELECT * FROM TEST;
> >VALUE
> >----------
> >X&Y
> >
> >
> >AMARENDRA
> >Pete Etten wrote:
> >
> >> Type 'set define off' at SQL*Plus prompt.
> >>
> >> News wrote in message <6ch1t5$n72_at_news.seed.net.tw>...
> >> >Hi, I got a problem, please help me!
> >> >I want to insert a string with '&' into my table, but Oracle always
> >> >recognized the &... as a variable and asked me to input a value...
 Here's
 my
> >> >trouble...
> >> > create table test ( name varchar2(32) );
> >> > insert into test values ('Butter&Bread');
> >> >then it asked me to input the Bread variable, :(
> >> >How can I tell Oracle I want & to be & but not a variable prefix? I
 tried
> >> >'\&' ,'"&' , '&&', but they didn't work and I can't get information from
 my
> >> >reference book, could someone help me about it? Please! Thanks.
> >> >BTW, how about single quotation mark?
> >> >
> >> >
> >
> >
> >
> >--
> >*****************************************************************
> >AMARENDRA B NETTEM
> >Oracle Certified DBA (OCP)
> >Whittman-Hart Inc.,
> >311 South Wacker Drive, Suite 3500
> >Chicago, IL 60606.
> >
> >Residence:
> >-----------
> >5039 N E River Road,
> >Apt. 1A
> >NORRIDGE, IL 60656
> >
> >
> >Ph.No. (708) 583 9870 (H)
> > (312) 913 6758 (W)
> >
> > E-mail:nettama_at_charlie.cns.iit.edu,
> > anettem_at_whittman-hart.com
> >
> >Homepage: http://www.iit.edu/~nettama
> >
> >****************************************************************
> >Opinions are mine and do not necessarily reflect those
> >of Whittman-hart Inc.

>>> Received on Wed Feb 25 1998 - 00:00:00 CST

Original text of this message

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