Re: Selecting "special" characters from a table

From: PERRY TRIMBLE <trimblep_at_aztec.inre.asu.edu>
Date: 24 Feb 1995 16:28:00 GMT
Message-ID: <3il1eg$7ss_at_news.asu.edu>


In a previous article, rocky_at_arthur.st.nepean.uws.edu.au (Rocqueforte OLeary) says:

>G'day,
>
>A fairly simple problem. I have a table with a varchar field ("Name"),
>into which I wish to put the name "O'Leary". How do I escape the ' character
>so sqlplus doesn't interpret it as the end of the column ?
>Likewise, how do I do a select * from table where name = "O'Leary" ?
>
>Thanks to anyone who can solve this!

Snip---

Rocky:
The following works for me:

SQL> insert into <table> values ('O''Leary');

SQL> select * from <table> where name like 'O''Leary';

Oracle SQL*Plus lets you escape the ' with an additional ' as '' produces ' within the string.

Good luck

Perry

-- 
/~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~\
| trimblep_at_aztec.asu.edu | Opinions expressed   |
| Oracle DBA >=1987      | are only my own.     |
\________________________|______________________/
Received on Fri Feb 24 1995 - 17:28:00 CET

Original text of this message