oracle中如何实现上月记录

How can we achieve last month record in oracle

我是 oracle 的新手,我正在编写一个查询,我必须在其中获取上个月的数据 我的查询:

 select to_char(sysdate,'MON') from dual  

但它给了我
AUG 是当前月份。
我希望输出为上个月的 JUL

怎样才能达到上个月的记录呢

select to_char(ADD_MONTHS (SYSDATE, -1),'MON') from dual 

--Move ahead one month: 
ADD_MONTHS (SYSDATE, 1);

--Move backward 1 month: 
ADD_MONTHS (SYSDATE, -1);  

http://www.oracle.com/technetwork/issue-archive/2012/12-jan/o12plsql-1408561.html

Oracle Database offers several built-in functions for shifting a date by the requested amount or finding a date:

 ADD_MONTHS—adds the specified number of months to or subtracts it from a date (or a timestamp) 
NEXT_DAY—returns the date of the first weekday named in the call to the function 
LAST_DAY—returns the date of the last day of the month of the specified date