
-- gb_6.sql
-- derived from 7-10

set autotrace on statistics

with emps as (
	select deptno, ename from scott.emp
) ,
mycube as (
  select  deptno, ename from emps
  union all
  select deptno, null ename from emps
  union all
  select null deptno, ename from emps
  union all
  select null deptno, null ename from emps
)
select /*+ gather_plan_statistics */ *
from mycube
group by deptno, ename

l

/

@showplan_last
