日期:2014-05-17  浏览次数:21205 次

oracle 月份中日的值必须介于 1 和当月最后一日之间
请教大家,在oracle存储过程中,有一个insert语句,总是报错,找到是插入时间的问题。比如:

case when nvl(pa_ptm,'0')='0' then v_invptm else to_date(pa_ptm,'yyyy/MM/dd HH24:mi:ss') end

我想当pa_ptm为null时插入v_invptm(date格式),但总提示“月份中日的值必须介于 1 和当月最后一日之间”,不知道是什么问题。测试把全部语句直接换成sysdate或者v_invptm就没问题。
请教大家这是什么原因?

insert into businv(
                                 invid,invoid,invlln,invpki,invown,invownnam,invdpt,
                                 invlot,invrmk,invrtm,invatm,invstm,
                                 invsku,invdes,invqty,invant,invcan,
                                 invlck,invloc,invunt,invvor,invwgt,
                                 invlpn,invsze,invlor,invatr,invtyp,
                                 invsty,invytm,invstp,invpkg,invscn,
                                 invscd,invtlc,invwhs,invwhsnam,
                                 invcon,invlocnam,invptm)
                          values(s_businv.nextval,v_newinvoid,v_invlln,v_invpki,v_invown,v_invownnam,v_invdpt,
                                 case when nvl(pa_lot,'0')='0' then v_invlot else pa_lot end,--批次
                                 case when nvl(pa_rmk,'0')='0' then v_invrmk else pa_rmk end,--备注
                                 case when nvl(pa_rtm,'0')='0' then v_invrtm else to_date(pa_rtm,'yyyy/MM/dd HH24:mi:ss') end,--收货时间
                                 case when nvl(pa_atm,'0')='0' then v_invatm else to_date(pa_atm,'yyyy/MM/dd HH24:mi: