Xref: alice comp.databases.oracle.misc:30508 comp.databases.oracle.server:48263 comp.databases.oracle.tools:24355
Path: alice!news-feed.fnsi.net!news.maxwell.syr.edu!dispose.news.demon.net!demon!news.demon.co.uk!demon!greendown.demon.co.uk!not-for-mail
From: mark.griffiths@greendown.demon.co.uk (Mark Griffiths)
Newsgroups: comp.databases.oracle.misc,comp.databases.oracle.server,comp.databases.oracle.tools
Subject: Re: Help What is the SQLPLUS escape character ?
Date: Wed, 05 May 1999 11:53:52 GMT
Message-ID: <37302a62.450754891@news.demon.co.uk>
References: <FAt5M6.D5M@midway.uchicago.edu>
X-Trace: news.demon.co.uk 925905033 nnrp-01:1639 NO-IDENT greendown.demon.co.uk:158.152.121.193
X-Complaints-To: abuse@demon.net
X-Newsreader: Forte Free Agent 1.11/32.235
Lines: 48

On Mon, 26 Apr 1999 17:49:57 GMT, "Seigmund Akinwande Johnson"
<asjohns@midway.uchicago.edu> wrote:

>I need to know what is escape character in oracle, I have a table which has
>data in it with apostrophes.
>
>'ants
>so I can't do   (select  * from table  where col like  ' 'ant' ')
>
>SAJ
>
>
>
Have you tried this???

SQL> select * from test
  2  /

COL1
--------------------
'ant

SQL> select * from test where col1 = '''ant';

COL1
--------------------
'ant

What you need to do is to double-up the apostrophes WITHIN the quoted
string.  The first apostrophe has the effect of escaping the second
apostrophe.

Try this example:

COL1
---------------------
'ant
B'stard

SQL> SELECT * FROM test WHERE col1 = 'B''stard';

COL1
-------------------
B'stard

Hope this helps

Mark Griffiths.
