Re: Query with NULL
Date: Tue, 29 Dec 2009 13:39:06 -0800 (PST)
On Dec 29, 12:19 pm, "bob123" <bob..._at_gmail.com> wrote:
> I have a lot of queries like below:>select * from bxat.no5
> >WHERE (no0_session_id = :wp18 OR :wp18 IS NULL)
> >AND (tbname = :wp19 OR :wp19 IS NULL)
> so an access full on no5
> How can I speed up this query ?
> Thanks in advance
> (Oracle 188.8.131.52)
If the issue is that the optimizer is choking on the ORs you might, barring adding indexes, want to consider changing your query from the present set of ORs to a set of simpler UNIONs, e.g.,
WHERE no0_session_id = :wp18
wp18 IS NULL
. . .
--Jeff Received on Tue Dec 29 2009 - 15:39:06 CST