2018/07/23 26

오라클 계층형 쿼리와 ROWNUM

SELECT * FROM ORCL_BRD_RPL START WITH BRD_PNO = 0 -- 시작형 CONNECT BY PRIOR BRD_NO = BRD_PNO -- 연결 ORDER SIBLINGS BY BRD_NO DESC; -- 정렬순서 *계층형 쿼리 SELECT * FROM ORCL_BRD_RPL START WITH BRD_PNO = 0 -- 시작형 CONNECT BY PRIOR BRD_NO = BRD_PNO -- 연결 ORDER SIBLINGS BY BRD_NO DESC; -- 정렬순서 *ROWNUM으로 순번 부여 및 ROWNUM 조건 사용 SELECT * FROM ( SELECT ROWNUM AS RNUM, E.* FROM (SELECT * FROM EMP ORDER BY ENAME ASC) ..

IT/Oracle 2018.07.23