日期:2014-05-17 浏览次数:20825 次
select to_char(add_months(last_day(sysdate)+1,-2),'yyyy-MM-dd') into v_lm_firstday from dual;
select to_char(add_months(last_day(sysdate),-1),'yyyy-MM-dd') into v_lm_lastday from dual;
select to_char(add_months(last_day(sysdate)+1,-1),'yyyy-MM-dd') into v_tm_firstday from dual;
select to_char(last_day(sysdate),'yyyy-MM-dd') into v_tm_lastday from dual;
select to_char(add_months(last_day(sysdate)+1,-2),'yyyy') into v_lastyear from dual;
select to_char(add_months(last_day(sysdate)+1,-2),'MM') into v_lastmonth from dual;
select to_char(add_months(last_day(sysdate)+1,-1),'yyyy') into v_thisyear from dual;
select to_char(last_day(sysdate),'MM') into v_thismonth from dual;
declare
v_month varchar2(6) :=&v_month;
v_first_day varchar2(12);
begin
v_first_day:=to_date(v_month
------解决方案--------------------
'01','yyyy--mm-dd');
dbms_output.put_line(v_first_day);
end;
剩下的建议楼主自己尝试下吧,这个其实都很简单的。