Re: Do all the legs of an "OR" with null comparisons get executed?
Date: Sat, 29 Mar 2008 13:14:55 +0100
"Arthernan" <arthernan_at_hotmail.com> schreef in bericht
On Mar 28, 11:41 am, "fitzjarr..._at_cox.net" <fitzjarr..._at_cox.net>
> 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