1.获取 截止当前月份为止的所有月份
SELECT
to_number(
TO_CHAR( add_months( trunc( SYSDATE, 'yy' ), ROWNUM - 1 ), 'MM' )) AS month
FROM
DUAL CONNECT BY ROWNUM <= ( SELECT months_between( trunc( SYSDATE, 'mm' ), trunc( SYSDATE, 'yy' )) + 1 FROM dual );
2.一年所有月份
SELECT
*
FROM
( SELECT TO_CHAR( ADD_MONTHS( SYSDATE, ROWNUM ), 'mm' ) mon FROM DUAL CONNECT BY ROWNUM <= 12 )
ORDER BY
mon ASC