Do all the legs of an "OR" with null comparisons get executed?
From: Arthernan <arthernan_at_hotmail.com>
Date: Fri, 28 Mar 2008 08:53:07 -0700 (PDT)
Message-ID: <e0f17db1-b076-45de-aee4-3564d8e0e502@a70g2000hsh.googlegroups.com>
Date: Fri, 28 Mar 2008 08:53:07 -0700 (PDT)
Message-ID: <e0f17db1-b076-45de-aee4-3564d8e0e502@a70g2000hsh.googlegroups.com>
If I do an explain plan of the statement below I can see that the
"and" clauses that have MMDDOB=NULL do not get executed
select * from v_search where
UPP_FIRST='JOHN' and UPP_LAST='SMITH' and MMDDOB=NULL and AA=1 or UPP_FIRST='JOHN' and UPP_LAST='SMITH' and BB=2 or UPP_FIRST='JOHN' and UPP_LAST='SMITH' and CC='CA' or UPP_FIRST='JOHN' and MMDDOB=NULL and AA=1 and BB=2 or UPP_FIRST='JOHN' and MMDDOB=NULL and AA=1 and CC='CA' or UPP_FIRST='JOHN' and BB=2 and CC='CA' or UPP_LAST='SMITH' and MMDDOB=NULL and AA=1 and BB=2 or UPP_LAST='SMITH' and MMDDOB=NULL and AA=1 and CC='CA' or UPP_LAST='SMITH' and BB=2 and CC='CA' orMMDDOB=NULL and AA=1 and BB=2 and CC='CA'
My problem is how to know if it does the same thing when I parametize the query as
select * from v_search where
UPP_FIRST=:UPP_FIRST and UPP_LAST=:UPP_LAST and MMDDOB=:MMDD and
AA=:AA or
UPP_FIRST=:UPP_FIRST and UPP_LAST=:UPP_LAST and BB=:BB or UPP_FIRST=:UPP_FIRST and UPP_LAST=:UPP_LAST and CC=:CC or UPP_FIRST=:UPP_FIRST and MMDDOB=:MMDD and AA=:AA and BB=:BB or UPP_FIRST=:UPP_FIRST and MMDDOB=:MMDD and AA=:AA and CC=:CC or UPP_FIRST=:UPP_FIRST and BB=:BB and CC=:CC or UPP_LAST=:UPP_LAST and MMDDOB=:MMDD and AA=:AA and BB=:BB or UPP_LAST=:UPP_LAST and MMDDOB=:MMDD and AA=:AA and CC=:CC or UPP_LAST=:UPP_LAST and BB=:BB and CC=:CC orMMDDOB=:MMDD and AA=:AA and BB=:BB and CC=:CC
Any ideas? Received on Fri Mar 28 2008 - 10:53:07 CDT