Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Join Order Bug?
Rather than just supply the answer to the exam question, take a look at your
indexes and explain plans...
"Buck Turgidson" <jc_va_at_hotmail.com> wrote in message
news:18c358a974081fa6d35efdcebc8fb02a.38849_at_mygate.mailgate.org...
> Can anyone help me understand why the first query does not return any
> rows, but by moving a line in the where clause, it then returns the rows
> I need?
>
> SQL> select version from v$instance;
>
> VERSION
> -----------------
> 8.1.6.0.0
>
> SQL> SELECT COUNT(*)
> 2 FROM PS_YE_DATA E ,PS_W2_COMPANY W
> 3 WHERE E.COMPANY = 'A24'
> 4 AND W.CALENDAR_YEAR = E.CALENDAR_YEAR
> 5 AND W.CALENDAR_YEAR = 2001
> 6 AND E.TAXFORM_ID = 'W'
> 7 AND W.COMPANY = E.COMPANY;
>
> COUNT(*)
> ----------
> 0
> SQL>
> SQL> SELECT COUNT(*)
> 2 FROM PS_YE_DATA E,PS_W2_COMPANY W
> 3 WHERE E.COMPANY = 'A24'
> 4 AND W.CALENDAR_YEAR = 2001
> 5 AND W.CALENDAR_YEAR = E.CALENDAR_YEAR -- switched position
> 6 AND E.TAXFORM_ID = 'W'
> 7 AND W.COMPANY = E.COMPANY;
>
> COUNT(*)
> ----------
> 4779
>
>
> --
> Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Received on Mon Feb 25 2002 - 14:26:28 CST