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

  • From: Veerabasaiah C <veeracb@xxxxxxxxx>
  • To: landstander668@xxxxxxxxx
  • Date: Fri, 14 Mar 2014 13:17:11 +1300

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@xxxxxxxxx>wrote:

> On Thu, Mar 13, 2014 at 4:55 PM, Daniel Fink <danielfink.work@xxxxxxxxx>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"

Other related posts: