Re: What does LIKE '%%' actually do in a WHERE clause?

From: Grant Allen <gxallen_at_gmail.com>
Date: Thu, 06 Oct 2011 20:53:49 +1100
Message-ID: <4E8D7AAD.60800_at_gmail.com>



On 6/10/2011 02:01, Stephane Faroult wrote:
> Norman,
> Hey, something new. I assume that 'id' is the PK (eg not null) and
> that it's the right type (varchar2 or char).
> I suspect that the optimizer:
> 1) is smart enough to see that LIKE '%' does nothing and remove it

Maybe I'm mis-interpreting things, but wouldn't LIKE '%' actually be semantically equivalent to IS NOT NULL. That is, for something to be LIKE "anything", it must therefore be known (or more specifically knowable) in order to evaluate its "likeness".

The %% thing is however, new and interesting to me :)

Ciao
Fuzzy
:-)

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Oct 06 2011 - 04:53:49 CDT

Original text of this message