现在有这样的一个存储过程create or replace procedure temp_mbr_hist_p is
sql_mbr_hist varchar2(32767);
p_date varchar2(500);
begin
temp_select_dos_fm_p(p_date);
sql_mbr_hist :='insert into temp_mbr_hist
    select mbrid from(  
  select mbrid,sum(case when effdat>lg+1 then 1 else 0 end)s,min(effdat)mi,max(expdat)ma 
from( 
    select mbrid,effdat,expdat, 
      lag(expdat)over(partition by mbrid order by expdat)lg from (select * from mbr_hist where effdat <= add_months(to_date('||p_date||',''yyyy-mm-dd''),12)  and expdat >= to_date('||p_date||',''yyyy-mm-dd''))) 
  where  effdat <=add_months(to_date('||p_date||',''yyyy-mm-dd''),12)  and expdat>=to_date('||p_date||',''yyyy-mm-dd'')
  group by mbrid) 
  where s=0 
    and mi <=to_date('||p_date||',''yyyy-mm-dd'')
    and ma>=add_months(to_date('||p_date||',''yyyy-mm-dd''),12)-1';
    dbms_output.put_line(sql_mbr_hist);
   EXECUTE IMMEDIATE sql_mbr_hist; 
   commit;
end temp_mbr_hist_p;
这里面的p_date参数是 2005-01-13 这个字符串
但是运行过程的时候这个过程报错为
ORA-01840: 输入值对于日期格式不够长是怎么回事啊   以前也没有遇到过这个错误啊!