SELECT *
FROM ORCL_BRD_RPL
START WITH BRD_PNO = 0 -- 시작형
CONNECT BY PRIOR BRD_NO = BRD_PNO -- 연결
ORDER SIBLINGS BY BRD_NO DESC; -- 정렬순서
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) E)
WHERE RNUM BETWEEN 3 AND 6;
*계층형쿼리와 ROWNUM 합치기
SELECT *
FROM (
SELECT ROWNUM AS RNUM, E.*
FROM (SELECT *
FROM ORCL_BRD_RPL
START WITH BRD_PNO = 0 -- 시작형
CONNECT BY PRIOR BRD_NO = BRD_PNO -- 연결
ORDER SIBLINGS BY BRD_NO DESC -- 정렬순서
) E)
WHERE RNUM BETWEEN 3 AND 6;
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) E)
WHERE RNUM BETWEEN 3 AND 6;
*계층형쿼리와 ROWNUM 합치기
SELECT *
FROM (
SELECT ROWNUM AS RNUM, E.*
FROM (SELECT *
FROM ORCL_BRD_RPL
START WITH BRD_PNO = 0 -- 시작형
CONNECT BY PRIOR BRD_NO = BRD_PNO -- 연결
ORDER SIBLINGS BY BRD_NO DESC -- 정렬순서
) E)
WHERE RNUM BETWEEN 3 AND 6;
'IT > Oracle' 카테고리의 다른 글
오라클 테이블 목록 보기 명령어 (0) | 2018.07.23 |
---|---|
오라클 제공 테스트 테이블 DUAL (0) | 2018.07.23 |
오라클 ROWNUM (0) | 2018.07.23 |
오라클 셋팅방법 및 명령어 (0) | 2018.07.23 |
오라클 PL/SQL insert, update, delete, merge 예제 (0) | 2018.07.19 |