Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: On insert, what characters do I need to escape? (or do I?)

Re: On insert, what characters do I need to escape? (or do I?)

From: Brian Lavender <brian_at_brie.com>
Date: Fri, 21 May 1999 20:49:15 GMT
Message-ID: <3747c63e.22299022@news.pacbell.net>


Thanks,

The double quote solved that.

I am still getting errors on my inserts when I try an ampersand.

insert into foo values (35.3,'tommy',null,'string & ampersand');

                                                  ^ escape this?

How do escape the ampersand?

brian

On Fri, 21 May 1999 12:02:51 GMT, clbeck_at_us.oracle.com (Christopher Beck) wrote:

>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



Brian Lavender
Sacramento, CA
http://www.brie.com/brian/

"If a train station is where the train stops, what is a workstation?" -- Phil Adamson Received on Fri May 21 1999 - 15:49:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US