오라클로 달력 만들기
본문 : http://www.gurubee.net/article/22424
with t as (
select to_date('201509','yyyymm') ym from dual)
SELECT * FROM (
SELECT MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '1', LEVEL)) SUN
, MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '2', LEVEL)) MON
, MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '3', LEVEL)) TUE
, MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '4', LEVEL)) WED
, MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '5', LEVEL)) THU
, MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '6', LEVEL)) FRI
, MIN (DECODE (TO_CHAR (YM + LEVEL - 1, 'd'), '7', LEVEL)) SAT
FROM T
CONNECT BY LEVEL <= LAST_DAY (YM) - YM + 1
GROUP BY TRUNC (YM + LEVEL, 'iw')
ORDER BY 7)
'it > SQL' 카테고리의 다른 글
ORACLE WITH AS (0) | 2015.12.23 |
---|---|
오라클 함수정리 (0) | 2015.09.10 |
pl/sql 공부 (0) | 2015.06.17 |
ora-01034 에러. 로그인 안될때, (0) | 2014.08.26 |
07_24 오라클... (0) | 2014.08.14 |