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

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Sat, 29 Mar 2008 13:14:55 +0100
Message-ID: <47ee32c6$0$14357$e4fe514c@news.xs4all.nl>

"Arthernan" <arthernan_at_hotmail.com> schreef in bericht news:e65e3d5b-d8be-4dec-a1fa-8c17a1e89bf2_at_b1g2000hsg.googlegroups.com... On Mar 28, 11:41 am, "fitzjarr..._at_cox.net" <fitzjarr..._at_cox.net> wrote:
> That is an alternative. I do think the logic is correct thought. Take
> the first comparison for example:

> UPP_FIRST='JOHN' and UPP_LAST='SMITH' and MMDDOB=NULL and AA=1

> 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