1、日期格式YYYY-MM-DD
SELECT TO_CHAR(TO_DATE('2018-01-28', 'YYYY-MM-DD') + ROWNUM - 1, 'YYYY-MM-DD') DAY_ID
FROM DUAL
CONNECT BY ROWNUM <= TO_DATE('2018-02-04', 'YYYY-MM-DD') - TO_DATE('2018-01-28', 'YYYY-MM-DD') + 1
2、日期格式YYYY-MM
SELECT TO_CHAR(ADD_MONTHS(TO_DATE('2018-01', 'YYYY-MM'),ROWNUM - 1), 'YYYY-MM') DAY_ID
FROM DUAL
CONNECT BY ROWNUM <=
MONTHS_BETWEEN(TO_DATE('2018-04', 'YYYY-MM'), TO_DATE('2018-01', 'YYYY-MM')) + 1