아래내용 참고하시기 바랍니다.
select a.dname, c.ename
from (
select a.deptno, a.dname, b.a
from dept a,
(
select 1 a from dual union all
select 2 from dual union all
select 3 from dual union all
select 4 from dual union all
select 5 from dual union all
select 6 from dual
) b
) a,
(
select row_number() over (partition by deptno order by empno) no,
ename,
deptno,
empno
from emp
) c
where a.deptno = c.deptno(+)
and a.a = c.no(+)
and a.deptno < 40
group by a.deptno, a.dname, c.empno, c.ename, a.a
order by a.deptno, c.empno, a.a