Re: 9205 Query behavior

  • From: Wolfgang Breitling <breitliw@xxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Mon, 17 May 2004 09:42:34 -0600

I wonder what kind of optimizer bug it is. I tried various hints, even RULE 
!, to no avail. However, adding rownum to the innermost sql produces the 
expected result:

SQL> l
   1  select distinct deptno from ( select rownum, deptno, job,
   2* min(sal) from scott.emp group by rownum, deptno, job)
SQL> /

     DEPTNO
----------
         10
         20
         30

3 rows selected.

SQL> l
   1  select * from ( select distinct deptno from ( select rownum, deptno, job,
   2* min(sal) from scott.emp group by rownum, deptno, job) where deptno = 20 )
SQL> /

     DEPTNO
----------
         20

1 row selected.

That seems to indicate some unnesting related error. However, using 
no_unnest hints does not change the behaviour.

At 03:55 PM 5/16/2004, you wrote:
>On 9205 database, load $OH/admin/utlsampl.sql
>
>run following query ... and observe ...
>
>set feedback on
>prompt Step 1
>select deptno, job, min(sal) from scott.emp group by deptno, job
>/
>prompt Step 2
>select distinct deptno from ( select deptno, job, min(sal) from
>scott.emp group by deptno, job ) where deptno = 20
>/
>prompt Step 3
>select * from ( select distinct deptno from ( select deptno, job,
>min(sal) from scott.emp group by deptno, job ) where deptno = 20 )
>/

regards

Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com 

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: