C
cyf4
Unregistered / Unconfirmed
GUEST, unregistred user!
新建oralce触发器,不执行,请帮忙,在线等create or replace trigger BDN_PurchasePartTab after insert or update or delete on PURCHASE_PART_tab for each row--外购件触发器declare sID varchar2(36); sParam varchar2(70);begin dbms_output.put_line('插入'); if deleting then sParam := ld.description; delete from DYSCM_BDNMAT@supp where fMATCODE = ld.part_no and fMATNAME = ld.description and fDOMAINCODE = ld.contract; /*清空供货信息表采购编码,采购员*/ update dyscm_supplier_materials@supp set fPURCHASERCODE = '', fPURCHASER = '' where fMATCODE = ld.part_no and fMATNAME = ld.description and fDOMAINCODE = ld.contract; end if; if inserting then sID := sys_guid(); sParam := :new.description; insert into DYSCM_BDNMAT@supp (fid, fMATCODE, fMATNAME, fDOMAINCODE, fPURCHASERCODE, fPURCHASER, fUNITNAME, fMATSPEC, VERSION) values (sID, :new.part_no, :new.description, :new.contract, :new.buyer_code, IFSAPP.PURCHASE_BUYER_API.Get_Name@erpnew.buyer_code), :new.default_buy_unit_meas, IFSAPP.INVENTORY_PART_API.GET_TYPE_DESIGNATION@erpnew.CONTRACT, :new.PART_NO), '0'); end if; /*供应商编号不能改,其余可以*/ if updating then sParam := ld.description; update DYSCM_BDNMAT@supp set fMATNAME = :new.description, fPURCHASERCODE = :new.buyer_code, fPURCHASER = IFSAPP.PURCHASE_BUYER_API.Get_Name@erpnew.buyer_code), fUNITNAME = :new.default_buy_unit_meas, fMATSPEC = IFSAPP.INVENTORY_PART_API.GET_TYPE_DESIGNATION@erpnew.CONTRACT, :new.PART_NO) where fMATCODE = ld.part_no and fDOMAINCODE = ld.contract; /*处理供货信息表采购编码,采购员*/ update dyscm_supplier_materials@supp set fPURCHASERCODE = :new.buyer_code, fPURCHASER = IFSAPP.PURCHASE_BUYER_API.Get_Name@erpnew.buyer_code) where fMATCODE = ld.part_no and fMATNAME = ld.description and fDOMAINCODE = ld.contract; end if; /*异常处理*/exception when others then Justep_Exception.insert_exception('外购件表', sParam, 'DYSCM_BDNMAT', sqlerrm, sysdate);end BDN_PurchasePartTab;