Re: varchar2 field being truncated on insert

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 2000/04/18
Message-ID: <8dibkp$89e$1_at_nnrp1.deja.com>#1/1


In article <8di8ft$ng0$1_at_bob.news.rcn.net>,   "Louis" <frolio_at_videoshare.com> wrote:
> Greetings all, I have a simple stored procedure that inserts a record
 into a
> table.
> The procedure takes several arguments, all of them varchar2's. I
 used this
> procedure to populate my table and I discovered something
 interesting. The
> test data I used for one of the fields was "Mike & Ike". However,
 when I
> looked
> at the data in the table I only saw "Mike", the "& Ike" portion was
> truncated?
> I believe the problem is with the "&" symbol. I would appreciate any
 help
> that
> any of you might be able to provide.
>
> Regards, Louis
> frolio_at_videoshare.com
>
>

if you are using sqlplus, the & has by default special meaning to it.

issue:

SQL> set define off

or

SQL> set scan off

if you do not want parameter substitution (it thought &Ike was a parameter). for example:

SQL> create table t ( x varchar2(25) );

Table created.

SQL> insert into t values ( 'Mike & Ike' ); Enter value for ike:
old 1: insert into t values ( 'Mike & Ike' ) new 1: insert into t values ( 'Mike ' )

1 row created.

SQL> set define off
SQL> insert into t values ( 'Mike & Ike' );

1 row created.

SQL> select * from t;

X



Mike
Mike & Ike
--
Thomas Kyte                              tkyte_at_us.oracle.com
Oracle Service Industries
http://osi.oracle.com/~tkyte/index.html
--
Opinions are mine and do not necessarily reflect those of Oracle Corp


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Apr 18 2000 - 00:00:00 CEST

Original text of this message