上个月的第一天:
SELECT to_char(last_day(add_months(SYSDATE, -2)) + 1, 'yyyy-mm-dd') as First_Day_of_Last_Month
FROM dual;
上个月的最后一天:
SELECT to_char(last_day(add_months(SYSDATE, -1)), 'yyyy-mm-dd') as Last_Day_of_Last_Month
FROM dual;
当月第一天和最后一天:
select to_char(trunc(sysdate, 'MONTH'), 'yyyy-mm-dd') First_DayOfMonth,
to_char(last_day(trunc(sysdate, 'MONTH')), 'yyyy-mm-dd') Last_DayOfMonth
from dual;
参考:http://fanli7.net/a/bianchengyuyan/C__/20130423/345149.html