select to_char(trunc(current_timestamp)-level,'YYYY-MM-DD') as date_dt
from dual
connect by level <= add_months(trunc(current_timestamp),12)-trunc(current_timestamp)
order by date_dt
from dual
connect by level <= add_months(trunc(current_timestamp),12)-trunc(current_timestamp)
order by date_dt
--current_timestamp取当前系统时间戳
--trunc(current_timestamp)取到当天零时
--connect by 递归调用
--level递归的层
--add_months日期函数,加n个月后是哪天
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22569416/viewspace-2123494/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22569416/viewspace-2123494/