시작일자 | 종료일자 | 이율 |
2010-12-14 | 2011-04-05 | 0.085 |
2011-04-06 | 2011-05-31 | 0.07 |
2011-06-01 | 2012-08-20 | 0.06 |
2012-08-21 | 9999-12-31 | 0.055 |
적요 | 1월 | 2월 | 3월 | 4월 | 5월 | 6월 | 7월 | 8월 | 9월 | 10월 | 11월 | 12월 |
2013년 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 | ||
2012년 | 0.06 | 0.06 | 0.06 | 0.06 | 0.06 | 0.06 | 0.06 | 0.055 | 0.055 | 0.055 | 0.055 | 0.055 |
2011년 | 0.085 | 0.085 | 0.085 | 0.07 | 0.07 | 0.06 | 0.06 | 0.06 | 0.06 | 0.06 | 0.06 | 0.06 |
2010년 | 0.085 |
WITH t1 AS ( SELECT '2010-12-14' sdt, '2011-04-05' edt, 0.085 rat FROM dual UNION ALL SELECT '2011-04-06', '2011-05-31', 0.070 FROM dual UNION ALL SELECT '2011-06-01', '2012-08-20', 0.060 FROM dual UNION ALL SELECT '2012-08-21', '9999-12-31', 0.055 FROM dual ) , t2 AS ( SELECT TO_CHAR(ADD_MONTHS(TO_DATE('201001', 'yyyymm'), LEVEL - 1), 'yyyy') yyyy , TO_CHAR(ADD_MONTHS(TO_DATE('201001', 'yyyymm'), LEVEL - 1), 'mm') mm , TO_CHAR(ADD_MONTHS(TO_DATE('201001', 'yyyymm'), LEVEL - 1), 'yyyy-mm-dd') sdt , TO_CHAR(ADD_MONTHS(TO_DATE('201001', 'yyyymm'), LEVEL) - 1, 'yyyy-mm-dd') edt FROM dual CONNECT BY LEVEL <= MONTHS_BETWEEN(TRUNC(sysdate, 'mm'), TO_DATE('201001', 'yyyymm')) + 1 ) SELECT yyyy , MIN(DECODE(mm, '01', rat)) m01 , MIN(DECODE(mm, '02', rat)) m02 , MIN(DECODE(mm, '03', rat)) m03 , MIN(DECODE(mm, '04', rat)) m04 , MIN(DECODE(mm, '05', rat)) m05 , MIN(DECODE(mm, '06', rat)) m06 , MIN(DECODE(mm, '07', rat)) m07 , MIN(DECODE(mm, '08', rat)) m08 , MIN(DECODE(mm, '09', rat)) m09 , MIN(DECODE(mm, '10', rat)) m10 , MIN(DECODE(mm, '11', rat)) m11 , MIN(DECODE(mm, '12', rat)) m12 FROM (SELECT yyyy, mm , MIN(rat) KEEP(DENSE_RANK LAST ORDER BY a.sdt, a.edt) rat FROM t1 a, t2 b WHERE b.sdt <= a.edt(+) AND b.edt >= a.sdt(+) GROUP BY yyyy, mm ) GROUP BY yyyy ORDER BY yyyy DESC ;
WITH t1 AS ( SELECT '2010-12-14' sdt, '2011-04-05' edt, 0.085 rat FROM dual UNION ALL SELECT '2011-04-06', '2011-05-31', 0.070 FROM dual UNION ALL SELECT '2011-06-01', '2012-08-20', 0.060 FROM dual UNION ALL SELECT '2012-08-21', '9999-12-31', 0.055 FROM dual ) , t2 AS ( SELECT TO_CHAR(ADD_MONTHS(sdt, LEVEL - 1), 'yyyy') yyyy , TO_CHAR(ADD_MONTHS(sdt, LEVEL - 1), 'mm') mm , TO_CHAR(ADD_MONTHS(sdt, LEVEL - 1), 'yyyy-mm-dd') sdt , TO_CHAR(ADD_MONTHS(sdt, LEVEL) - 1, 'yyyy-mm-dd') edt FROM (SELECT TO_DATE(SUBSTR(MIN(sdt), 1, 7), 'yyyy-mm') sdt FROM t1) CONNECT BY LEVEL <= MONTHS_BETWEEN(TRUNC(sysdate, 'mm'), sdt) + 1 ) SELECT yyyy , MIN(DECODE(mm, '01', rat)) m01 , MIN(DECODE(mm, '02', rat)) m02 , MIN(DECODE(mm, '03', rat)) m03 , MIN(DECODE(mm, '04', rat)) m04 , MIN(DECODE(mm, '05', rat)) m05 , MIN(DECODE(mm, '06', rat)) m06 , MIN(DECODE(mm, '07', rat)) m07 , MIN(DECODE(mm, '08', rat)) m08 , MIN(DECODE(mm, '09', rat)) m09 , MIN(DECODE(mm, '10', rat)) m10 , MIN(DECODE(mm, '11', rat)) m11 , MIN(DECODE(mm, '12', rat)) m12 FROM (SELECT yyyy, mm , MIN(rat) KEEP(DENSE_RANK LAST ORDER BY a.sdt, a.edt) rat FROM t1 a, t2 b WHERE b.sdt <= a.edt(+) AND b.edt >= a.sdt(+) GROUP BY yyyy, mm ) GROUP BY yyyy ORDER BY yyyy DESC ;