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

Home -> Community -> Usenet -> c.d.o.tools -> Re: apostrophe in Oracle field

Re: apostrophe in Oracle field

From: Troy Meyerink <meyerink_at_usgs.gov>
Date: Tue, 24 Apr 2001 21:22:11 GMT
Message-ID: <3AE5EE83.52198B07@usgs.gov>

Zhiliang Hu wrote:

> There must be someone encounterred and have a solution to this problem:
>
> When you have a " ' " (apostrophe) among some text data in a table
> field,
> it causes trouble when you do, for example:
>
> > select * from table where name='O'Brian':
>
> ERROR:
> ORA-01756: quoted string not properly terminated
>
> Any general approach to avoid this?
>
> Thanks in advance!
>
> Zhiliang

 Zhiliang,

You need to use two quotes in a row to negate the meaning of the quotes.

select * from table where name = 'O''Brian';

This should work.

--
Troy Meyerink
Oracle DBA
Raytheon
EROS Data Center
USGS
meyerink_at_usgs.gov
Received on Tue Apr 24 2001 - 16:22:11 CDT

Original text of this message

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