Re: Do all the legs of an "OR" with null comparisons get executed?

From: Shakespeare <>
Date: Sat, 29 Mar 2008 13:14:55 +0100
Message-ID: <47ee32c6$0$14357$>

"Arthernan" <> schreef in bericht On Mar 28, 11:41 am, "" <> wrote:
> That is an alternative. I do think the logic is correct thought. Take
> the first comparison for example:


> I do not want to get any rows back if MMDDOB was NULL. In this case I

In that case you should use

WHERE MMDDOB is not NULL and (--- rest of your conditions).

MMDDOB = NULL is ALWAYS false (or actually undefined but not true) so these clauses dont need to be calculated. You could replace the whole part with "0=1"

> want Oracle to skip that comparison at execution. And it does do that
> when it is not parametized. I just don't know if it will when I
> parametize it.

> The code is very simple and straight forward as it is. And I do
> believe it is also correct.

No it's not, comparing with '=NULL' id definitely wrong.

> I don't want to make it complicated if it
> not necessary.

But you already did.

> Arturo Hernandez

Shakespeare Received on Sat Mar 29 2008 - 07:14:55 CDT

Original text of this message