当前位置: 代码迷 >> Oracle开发 >> oracle 月份中日的值必须介于 一 和当月最后一日之间
  详细解决方案

oracle 月份中日的值必须介于 一 和当月最后一日之间

热度:81   发布时间:2016-04-24 06:53:25.0
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:ss') end,--入库时间
                                 SYSDATE,
                                 v_invsku,v_invdes,pa_qty,pa_qty,pa_qty,0,v_locid,
                                 case when nvl(pa_unt,'0')='0' then v_invunt else pa_unt end,
                                 case when nvl(pa_vor,'0')='0' then v_invvor else pa_vor end,
                                 case when nvl(pa_wgt,'0')='0' then v_invwgt else pa_wgt end,
                                 case when nvl(pa_lpn,'0')='0' then v_invlpn else pa_lpn end,
                                 case when nvl(pa_sze,'0')='0' then v_invsze else pa_sze end,
                                 case when nvl(pa_lor,'0')='0' then v_invlor else pa_lor end,
  相关解决方案