SELECT '000' AS PAR, '11P' AS CHI FROM DUAL UNION ALL
SELECT '11P' AS PAR, '1EX' AS CHI FROM DUAL UNION ALL
SELECT '1EX' AS PAR, '1EA' AS CHI FROM DUAL UNION ALL
SELECT '1EA' AS PAR, '1EK' AS CHI FROM DUAL UNION ALL
SELECT '1EK' AS PAR, '1E1' AS CHI FROM DUAL UNION ALL
SELECT '000' AS PAR, '11S' AS CHI FROM DUAL UNION ALL
SELECT '11S' AS PAR, '1RY' AS CHI FROM DUAL UNION ALL
SELECT '1RY' AS PAR, '1RM' AS CHI FROM DUAL UNION ALL
SELECT '1RM' AS PAR, '1R3' AS CHI FROM DUAL UNION ALL
SELECT '000' AS PAR, '11S' AS CHI FROM DUAL UNION ALL
SELECT '11S' AS PAR, '1RY' AS CHI FROM DUAL UNION ALL
SELECT '1RY' AS PAR, '1RN' AS CHI FROM DUAL UNION ALL
SELECT '1RN' AS PAR, '1R9' AS CHI FROM DUAL UNION ALL
SELECT '000' AS PAR, '11S' AS CHI FROM DUAL UNION ALL
SELECT '11S' AS PAR, '1RY' AS CHI FROM DUAL UNION ALL
SELECT '1RY' AS PAR, '1S3' AS CHI FROM DUAL
위 데이터를 아래와 같이 5개의 컬럼으로 표현하고 싶은데 가능할까요?
트리구조에서 '000' 의 CHI는 COL1이 되고 그다음부터 순차적으로 COL2, COL3, COL4가 되며
가장 하위 데이터는 무조건 COL5가 되어야 합니다.
COL1 COL2 COL3 COL4 COL5
========================
11P 1EX 1EA 1EK 1E1
11S 1RY 1RM 1R3
11S 1RY 1RN 1R9
11S 1RY 1S3 |