SELECT RPAD(' ',LEVEL*3) || ENAME AS EMPLOYEE, LEVEL, SAL, JOB
FROM EMP
START WITH ENAME = 'KING'
CONNECT BY PRIOR EMPNO = MGR;
EMPLOYEE | LEVEL | SAL | JOB
KING | 1 | 5000 | PRESIDENT
JONES | 2 | 2975 | MANAGER
SCOTT | 3 | 3000 | ANALYST
ADAMS | 4 | 1100 | CLERK
FORD | 3 | 3000 | ANALYST
SMITH | 4 | 800 | CLERK
BLAKE | 2 | 2850 | MANAGER
ALLEN | 3 | 1600 |SALESMAN
SELECT RPAD(' ', LEVEL*3) || ENAME AS EMPLOYEE, LEVEL, SAL, JOB
FROM EMP
START WITH ENAME = 'KING'
CONNECT BY PRIOR EMPNO = MGR AND ENAME != 'BLAKE';
SELECT RPAD(' ', LEVEL*3) || ENAME AS EMPLOYEE, LEVEL, SAL, JOB
FROM EMP
START WITH ENAME = 'KING'
CONNECT BY PRIOR EMPNO = MGR
ORDER SIBLINGS BY SAL DESC;
SELECT ENAME, SYS_CONNECT_BY_PATH(ENAME,'/') AS PATH
FROM EMP
START WITH ENAME = 'KING'
CONNECT BY PRIOR EMPNO = MGR