--月份 SELECT TO_CHAR(ADD_MONTHS(SYSDATE, - (ROWNUM - 1)), 'yyyy-mm') yyyymmdd FROM DUAL CONNECT BY ROWNUM < MONTHS_BETWEEN(SYSDATE, TO_DATE ('201711', 'yyyymm'))+1 --天 select to_char(sysdate-(ROWNUM-1),'yyyymmdd') from dual CONNECT BY ROWNUM < SYSDATE-(TO_DATE ('20171104', 'yyyymmdd'))+1