简单的存储过程
简单的存储过程
CREATE OR REPLACE PROCEDURE update_itemactivity_strDueDate(in_startData in varchar,in_customer_code in varchar) is begin update gadata0008.itemactivity itac set (lngtermid,strDueDate)=( select tt.lngtermid,to_char(to_date(itac.strdate,'yyyy-MM-dd')+to_number(tt.intdueday),'yyyy-MM-dd') from gadata0008.customer cc join gadata0008.term tt on tt.lngtermid=cc.lngtermid where cc.lngcustomerid=itac.lngcustomerid ) where itac.strdate=itac.strduedate and to_date(itac.strdate,'yyyy-MM-dd')>to_date(in_startData,'yyyy-MM-dd') and itac.lngcustomerid in ( select cc.lngcustomerid from gadata0008.customer cc join gadata0008.term tt on tt.lngtermid=cc.lngtermid where ((tt.strtermname not in ('现金') and tt.intdueday not in (0)) or cc.lngtermid!=itac.lngtermid ) and cc.strcustomercode=in_customer_code ); END update_itemactivity_strDueDate;