I had the same thing with null values and function-based indexes. Oracle does not like it.
__ ____ ____ ____ ____ ____ ____
From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] On Behalf Of Jared Still Sent: 13. j�l� 2006 16:04 To: gints.plivna@(protected) Cc: oracle-l Subject: Re: Smells like oracle bug?
It appears that Oracle is taking your hint quite seriously.
As there is no data in idx2 due to the only value in the id2 column being null, Oracle is not returning any rows.
Take idx2 out of the hint, and you get data.
-- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist
On 7/13/06, Gints Plivna <gints.plivna@(protected)> wrote:
... SQL> create index idx2 on blahh (id2);
Index created.
SQL> insert into blahh values (1, null);
1 row created.
...
SQL> select 'x' from dual where exists ( 2 select /*+ index_ffs (blahh idx1 idx2) */ 'z' from blahh where 3 (id1 = 1 and id2 is null) or (id1 is null and id2 = 1)) 4 /
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD> <BODY> <DIV dir=ltr align=left><SPAN class=815591116-13072006><FONT face=Arial color=#0000ff size=2>I had the same thing with null values and function-based indexes. Oracle does not like it.</FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=815591116-13072006></SPAN> </DIV><BR> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left> <HR tabIndex=-1> <FONT face=Tahoma size=2><B>From:</B> oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] <B>On Behalf Of </B>Jared Still<BR><B>Sent:</B> 13. j�l� 2006 16:04<BR><B>To:</B> gints.plivna@(protected)<BR><B>Cc:</B> oracle-l<BR><B>Subject:</B> Re: Smells like oracle bug?<BR></FONT><BR></DIV> <DIV></DIV>It appears that Oracle is taking your hint quite seriously.<BR><BR >As there is no data in idx2 due to the only value in the<BR>id2 column being null, Oracle is not returning any rows.<BR><BR>Take idx2 out of the hint, and you get data. <BR><BR>-- <BR>Jared Still<BR>Certifiable Oracle DBA and Part Time Perl Evangelist<BR><BR><BR> <DIV><SPAN class=gmail_quote>On 7/13/06, <B class=gmail_sendername>Gints Plivna</B> <<A href="mailto:gints.plivna@(protected)">gints.plivna@(protected)</A>> wrote:</SPAN> <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204 ,204) 1px solid">...<BR>SQL> create index idx2 on blahh (id2);<BR><BR>Index created.<BR><BR>SQL> insert into blahh values (1, null);<BR><BR>1 row created.<BR><BR>...<BR><BR>SQL> select 'x' from dual where exists (<BR> 2 select /*+ index_ffs (blahh idx1 idx2) */ 'z' from blahh where <BR> 3 (id1 = 1 and id2 is null) or (id1 is null and id2 = 1))<BR> 4 /<BR><BR>no rows selected<BR><BR><BR></BLOCKQUOTE></DIV><BR> <P><SPAN style="FONT-SIZE: 7.5pt; COLOR: gray; FONT-FAMILY: Arial"><BR>Fyrirvari /Disclaimer<BR><A href="http://www.landsbanki.is/disclaimer"><SPAN style="COLOR: gray">http://www.landsbanki.is/disclaimer</SPAN></A><o:p></o:p>< /SPAN></P> </BODY></HTML>