[ORACLE] 계층형 구조에서 최하위 항목 출력

2018. 10. 26. 13:47Database/Oracle

SELECT *

FROM 

    DEPT_INFO

WHERE  

    CONNECT_BY_ISLEAF  = 1

    AND CONNECT_BY_ISCYCLE = 0

START WITH PARNTS_DEPT_CD = '00000000'

CONNECT BY NOCYCLE PRIOR DEPT_CD = PARNTS_DEPT_CD;