本周日期
select to_char(trunc(sysdate-to_number(to_char(sysdate,‘d’)))+rownum+1,‘yyyy-mm-dd’) as days
from dual connect by rownum <= to_number(to_char(sysdate,‘d’))-1
本月
select to_char(trunc(sysdate-to_number(to_char(sysdate,'dd')))+rownum,'yyyy-mm-dd') as days
from dual connect by rownum <= to_number(to_char(sysdate,'dd'))
本季月份
SELECT TO_CHAR(ADD_MONTHS(ADD_MONTHS(TRUNC(SYSDATE, 'YYYY'),A * 3),-ROWNUM),'YYYY-MM') days
FROM (SELECT TO_CHAR(SYSDATE,'Q') A FROM DUAL)
CONNECT BY ROWNUM <= 3
ORDER BY 1
本年月份
select to_char(add_months(sysdate, -t.rn), 'yyyy-mm') days
from dual a, (select rownum - 1 rn from dual connect by rownum < = 12) t
where to_char(add_months(sysdate, -t.rn), 'yyyy') =to_char(sysdate, 'yyyy')
order by to_char(add_months(sysdate, -t.rn), 'yyyy-mm')