如何使用oracle
从sysdate获取以前的11个月名称我试过,我想在某些日期之间获得月份名称
select add_months (trunc (to_date('10/18/2007','MM/DD/YYYY'), 'MM'), 1*Level -1)
Month FROM Dual
CONNECT BY Level <= MONTHS_BETWEEN(to_date('11/17/2008','MM/DD/YYYY'), to_date('10/18/2007','MM/DD/YYYY')) + 1
order by month
答案 0 :(得分:1)
可能你需要这样的东西:
ready()
答案 1 :(得分:1)
你可以使用它:
SELECT TO_CHAR( ADD_MONTHS(SYSDATE,-1*LEVEL ),'MON') MONTH_NAME
FROM DUAL
CONNECT BY LEVEL <= MONTHS_BETWEEN( TRUNC(SYSDATE,'MM') , ADD_MONTHS( TRUNC(SYSDATE,'MM'),-11))
ORDER BY LEVEL