Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to insert Special Characters ?
Prakash,
Two methods:
SQL> alter table test modify (c1 varchar2(100));
Table altered.
SQL> insert into test values ('where part_no=''1234'' and name = ''guest''');
1 row created.
SQL> select * from test;
C1
SQL> set define off
SQL> show def
define OFF
SQL> insert into test values ('bla&bla');
1 row created.
SQL> select * from test;
C1
where part_no='1234' and name = 'guest' bla&bla
SQL> insert into test values ('the cat sat on the "mat"');
1 row created.
SQL> select * from test;
C1
where part_no='1234' and name = 'guest' bla&bla the cat sat on the "mat"
ALTERNATIVE METHOD (Not guaranteed to work cross-platform):
SQL> select ascii('&'), ascii('"') from sys.dual SQL> /
ASCII('&') ASCII('"') ---------- ---------- 38 34
SQL> insert into test values ('bla' || CHR(38) || 'bla' || CHR(34) || 'bla');
1 row created.
SQL> select * from test;
C1
where part_no='1234' and name = 'guest' bla&bla the cat sat on the "mat" bla&bla"bla
SQL> spool off
Cheers,
John Thomas
Contract Oracle Development DBA (currently available for development,
development support, performance tuning and other work.)
In article <F001.004A6DD2.20020730205823_at_fatcity.com>, guess who
<yours_in_at_rediffmail.com> writes
>I want to insert the following characters ,
>
>1.) '
>
>2.) "
>
>3.) &
>
>for example i want to insert the following line as it looks...
>
> where part_no='1234' and name='guest'
>
>how to do ?
>
>can anyone help ...
>
>Regards,
>Prakash.
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- John Thomas -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: John Thomas INET: john_at_toronto.demon.co.uk Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Jul 31 2002 - 04:48:20 CDT