首页 > 代码库 > 触发器
触发器
create or replace TRIGGER CAR_TEAM_LOAD_QUANTITY_TRG AFTER INSERT OR UPDATE ON ATT_TRADE DECLARE FK_CAR_TEAM_TASK NUMBER(15,0);--车队任务id TOTAL_LOAD_NUM NUMBER(15,3); --已疏港量 logid integer; contentstr varchar(4000); CURSOR numlist is (SELECT team.id id, SUM(trade.net) net FROM CAR_TEAM_DISPACHER_INFO team LEFT JOIN ATT_VEHICLEDISPATCH dis ON team.id=dis.FK_CAR_TEAM_DISPACHER_INFO_ID LEFT JOIN ATT_TRADE trade ON trade.FLEETTASKID =dis.id WHERE trade.DATASTATUS=‘1‘ and trade.FLEETTASKID is not null GROUP BY team.ID); BEGIN FOR num_row IN numlist LOOP begin update CAR_TEAM_DISPACHER_INFO set LOAD_QUANTITY=num_row.net/1000 where id=num_row.id; exception when others then SELECT WEBLOG_SEQ.NEXTVAL INTO logid FROM SYS.DUAL; contentstr := ‘update CAR_TEAM_DISPACHER_INFO set LOAD_QUANTITY=‘||num_row.net||‘where id=‘||num_row.id; insert into weblog (id,context) values (logid,contentstr); end; end loop; END;
触发器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。