
-- gb_10b.sql
-- original

set echo on
set autotrace off

drop table my_emp;

create table my_emp
as
select * from scott.emp;

insert into my_emp(empno,ename,job,deptno) values(1024,'JKSTILL',NULL,NULL);
commit;

select 
	decode(grouping(ename),1,'SA_NULL',ename) ename
	, decode(grouping(job),1,'SA_NULL',job) job
	, decode(grouping(deptno),1,'SA_NULL',deptno) deptno
from my_emp
group by cube(ename,job,deptno)

l

/

set echo off

