Re: sql*plus INSERT problem

From: S. Kannan <skannan_at_cardinal.fs.com>
Date: 1995/11/11
Message-ID: <4837f3$qn8_at_cardinal.fs.com>#1/1


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. **
---------------------------------------------------------------------------
Received on Sat Nov 11 1995 - 00:00:00 CET

Original text of this message