Re: sql*plus INSERT problem

From: Martin Farber <farber_at_nynexst.com>
Date: 1995/11/14
Message-ID: <48ald1$ahu_at_news.nynexst.com>#1/1


In article qn8_at_cardinal.fs.com, skannan_at_cardinal.fs.com ( S. Kannan) writes:
>Brad Stinson (bstinson_at_pinpoint.avl.com) wrote:
>
>: If I attempt to insert values into a VARCHAR2 field that contain
>: the '&' character, sql*plus prompts me for the value of the
>: argument specified by the string following the '&' character.
>: Here is the scenario:
 

>: create table testtable (field1 varchar2(50));
>: insert into testtable values ('abcd&efg');
 

>: rather than inserting abcd&efg into field1, sql*plus gives
>: me the prompt:
 

>: Enter value for efg:
 

>: How do I enter the & character in an insert statement????
 

>: Brad
>: bstinson_at_pinpoint.avl.com
>
>you need to do the following to acheive what you want :
>
>1. set escape on. [the default escape character is "\" (hex 5c)]
>2. insert into testtable values ('abcd\&efg'); The backslash
> will indicate to sql*plus that the ampersand following it is
> a literal and is not to be interpreted as a user variable.
>
>Hope this helps.
>--
>---------------------------------------------------------------------------
>Kannan
>Email: skannan_at_fs.com
>Mastech Systems Corporation
>
>The above are my own comments and opinion. They do not purport that of
>anybody else.
> ** Different is Not Better. Better is not Different. **
>---------------------------------------------------------------------------

You can also change the define character entirely if ampersands become an annoyance:

        SET DEFINE ~ This will change the variable prefix to tilde, so that &efg is not a variable, but ~account_number is.

---
<<MFF>>


-------------------------------------

"Twenty-Five years ago it meant something to be Crazy!"

			-- Charles Manson
Received on Tue Nov 14 1995 - 00:00:00 CET

Original text of this message