Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: On insert, what characters do I need to escape? (or do I?)
On Thu, 20 May 1999 18:23:52 GMT, brian_at_brie.com (Brian Lavender) wrote:
>When I do an sql insert
>insert into foo values (35.3,'tommy',null,''','!@#$><-'',null);
> ^ how do I treat this?
To insert a ' you can escape it with a second '. So to insert a ' you can do the following...
Given
SQL> desc t Name Null? Type ------------------------------- -------- ---- ID NUMBER VAL VARCHAR2(100)
SQL> insert into t ( id, val ) values ( 1, '''' ); 1 row created.
SQL> select * from t;
ID VAL
---------- ----------
1 '
To insert two ', use this ...
SQL> insert into t ( id, val ) values ( 2, '''''' ); 1 row created.
SQL> select * from t;
ID VAL
---------- ----------
1 ' 2 ''
hope this helps.
chris.
>
>I guess I have to at least escape the single quotation mark. Do I do
>that with a backslash? What about other characters? Do I need to give
>them special treament?
>
>brian
>--------------------
>Brian Lavender
>Sacramento, CA
>http://www.brie.com/brian/
>
>"If a train station is where the train stops,
>what is a workstation?" -- Phil Adamson
--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.
![]() |
![]() |