SQL> r 1 select empno, 2 ename, 3 job, 4 sys_connect_by_path(job, '/') job_hierarchy 5 from emp 6 connect by prior empno = mgr 7 start with mgr is null 8* EMPNO ENAME JOB JOB_HIERARCHY ---------- ---------- --------- --------------------------------- 7839 KING PRESIDENT /PRESIDENT 7566 JONES MANAGER /PRESIDENT/MANAGER 7788 SCOTT ANALYST /PRESIDENT/MANAGER/ANALYST 7876 ADAMS CLERK /PRESIDENT/MANAGER/ANALYST/CLERK 7902 FORD ANALYST /PRESIDENT/MANAGER/ANALYST 7369 SMITH CLERK /PRESIDENT/MANAGER/ANALYST/CLERK 7698 BLAKE MANAGER /PRESIDENT/MANAGER 7499 ALLEN SALESMAN /PRESIDENT/MANAGER/SALESMAN 7521 WARD SALESMAN /PRESIDENT/MANAGER/SALESMAN 7654 MARTIN SALESMAN /PRESIDENT/MANAGER/SALESMAN 7844 TURNER SALESMAN /PRESIDENT/MANAGER/SALESMAN 7900 JAMES CLERK /PRESIDENT/MANAGER/CLERK 7782 CLARK MANAGER /PRESIDENT/MANAGER 7934 MILLER CLERK /PRESIDENT/MANAGER/CLERK 14 Zeilen ausgewählt.
Funktioniert seit 9i.
Keine Kommentare:
Kommentar veröffentlichen