먼저 CONNECT BY 절 이용..
---------------------------------------------------------------------------------------------------------------------------
자연수 : n
SELECT /*+ ORDERED USE_NL(A,B) */
NO1 VAL
FROM (
SELECT DECODE(SIGN(n-LEVEL),-1,(n*2)-LEVEL,LEVEL) NO1
FROM DUAL
CONNECT BY LEVEL <= (n*2)-1
) A,
(
SELECT LEVEL NO2
FROM DUAL
CONNECT BY LEVEL <= POWER(n,2)
) B
WHERE A.NO1 >= B.NO2;
---------------------------------------------------------------------------------------------------------------------------
COPY_T 테이블 이용
요거 따로 활용 용도는 다들 아실거라..생략
COPY_T 컬럼명이 NO 일때 데이타는 1,2,3.......N 들어있다치고..^^*
---------------------------------------------------------------------------------------------------------------------------
SELECT /*+ ORDERED USE_NL(A, B) */
DECODE(SIGN(N-A.NO),-1,(N*2)-A.NO,A.NO) VAL
FROM (
SELECT 3 N -- 자연수
FROM DUAL
) V, COPY_T A, COPY_T B
WHERE A.NO <= (N*2)-1
AND DECODE(SIGN(N-A.NO),-1,N*2-A.NO,A.NO) >= B.NO;
---------------------------------------------------------------------------------------------------------------------------