Accounting Calendar template

clip_image001

SELECT INITCAP (TO_CHAR (TO_DATE (&year || '-' || LPAD (ROWNUM, 2, '0'), 'yyyy-mm'), 'MON', 'NLS_DATE_LANGUAGE=AMERICAN')) prefix

, 'Month' TYPE

, TO_CHAR (&year) year

, TO_CHAR (TO_DATE (&year || '-' || LPAD (ROWNUM, 2, '0'), 'yyyy-mm'), 'q') quarter

, TO_CHAR (ROWNUM) num

, UPPER (TO_CHAR (TO_DATE (&year || '-' || LPAD (ROWNUM, 2, '0'), 'yyyy-mm'), 'dd-mon-yyyy')) date_from

, UPPER (TO_CHAR (LAST_DAY (TO_DATE (&year || '-' || LPAD (ROWNUM, 2, '0'), 'yyyy-mm')), 'dd-mon-yyyy')) date_to

, INITCAP (TO_CHAR (TO_DATE (&year || '-' || LPAD (ROWNUM, 2, '0'), 'yyyy-mm'), 'mon-yy')) name

FROM DUAL

CONNECT BY LEVEL <= 12

UNION ALL

SELECT 'Adj' prefix

, 'Month' TYPE

, TO_CHAR (&year) year

, '4' quarter

, '13' num

, UPPER (TO_CHAR (LAST_DAY (TO_DATE (&year || '-12', 'yyyy-mm')), 'dd-mon-yyyy')) date_from

, UPPER (TO_CHAR (LAST_DAY (TO_DATE (&year || '-12', 'yyyy-mm')), 'dd-mon-yyyy')) date_to

, 'Adj-' || TO_CHAR (TO_DATE (&year, 'yyyy'), 'yy') name

FROM DUAL;

posted @ 2018-06-24 23:31  全威儒  阅读(374)  评论(0编辑  收藏  举报