Re: Like displays rows which doesn't match the condition or am i wrong.

From: Veerabasaiah C <veeracb_at_gmail.com>
Date: Fri, 14 Mar 2014 13:17:11 +1300
Message-ID: <CAKE9HuPbzFYv8UrCHi2bCMh2XtyZZ01SNej9CNm-UXNvs=1Dvg_at_mail.gmail.com>



Thank you all .. that explains :)

SQL> select * from test where c1 like 'a1\_%' escape '\';

C1


a1_a2
a1_a3
a1_a4

SQL> On Fri, Mar 14, 2014 at 11:01 AM, Adric Norris <landstander668_at_gmail.com>wrote:

> On Thu, Mar 13, 2014 at 4:55 PM, Daniel Fink <danielfink.work_at_gmail.com>wrote:
>
>> To match strings with the character '_' in them, you will need to use the
>> escape character '\' (or whatever you have defined it as) in the LIKE
>> string.
>>
>> For example (off the top of my head...no access to a nonclient db right
>> now)
>>
>> LIKE 'a1\_%' should return strings matching the literal value of 'a1_'
>> and 0 or more following characters.
>>
>
> Very close, but you need to explicitly define the escape character (there
> isn't a default). For example:
>
> LIKE 'a1\_%' escape '\'
>
>

-- 
Veerabasaiah C B
"Only put off until tomorrow what you are willing to die having left
undone. - Picasso"

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 14 2014 - 01:17:11 CET

Original text of this message