2012년 10월 10일 수요일
자식으로부터 부모 가져와서 한줄로 표현
SELECT SUBSTR(MAX(SYS_CONNECT_BY_PATH (MENU_NM, ' > ')), 2) PATH,
MAX(MENU_NM)
FROM (
SELECT
MENU_NM,
MENU_LEVEL
FROM BNT_MENU
WHERE USE_YN = 'Y'
START WITH MENU_ID = (
SELECT
MENU_ID as v_menu_id
FROM BNT_MENU A
WHERE ( A.MENU_URL = '/sample/grid/indexBasicGridSample.do'
OR INSTR(A.FAMILY_URL, '/sample/grid/indexBasicGridSample.do') > 0
)
AND A.USE_YN = 'Y'
AND ROWNUM <= 1)
CONNECT BY PRIOR P_MENU_ID = MENU_ID
ORDER BY MENU_LEVEL ASC
)
START WITH MENU_LEVEL = 1
CONNECT BY PRIOR MENU_LEVEL = MENU_LEVEL - 1
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기