계층형 데이타 Query
-- 정전개 SELECT CONNECT_BY_ROOT PGM_ID "root" , LEVEL , LPAD(' ', 4*(LEVEL-1)) || PGM_ID AS PGM_ID , PGM_NM, UP_PGM_ID , SYS_CONNECT_BY_PATH (PGM_NM, '=>') AS full_name // Path , CONNECT_BY_ISLEAF "leaf" // 최하위 레벨 여부 From TS_PROG2 WHERE USE_YN = 'Y' START WITH PGM_id = 'root' CONNECT BY PRIOR PGM_ID = UP_PGM_ID ORDER SIBLINGS BY PGM_NM -- 역전개 SELECT LEVEL , LPAD(' ', 4*(LEVEL-1)) || PGM_ID AS PGM_..
DataBase/Oracle
2012. 5. 18. 15:50