Re: Help What is the SQLPLUS escape character ?

From: Mark Griffiths <mark.griffiths_at_greendown.demon.co.uk>
Date: Wed, 05 May 1999 11:53:52 GMT
Message-ID: <37302a62.450754891_at_news.demon.co.uk>


On Mon, 26 Apr 1999 17:49:57 GMT, "Seigmund Akinwande Johnson" <asjohns_at_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. Received on Wed May 05 1999 - 13:53:52 CEST

Original text of this message