oracle 触发器的编写
1.完整的写法
create or replace trigger UPDATE_WORKSTATIO AFTER UPDATE on WORKSTATIO for each row begin UPDATE GY_SB@x3v6 SET UPDATED=SYSDATE,REMARK= (select A2.TEXTE_0 from ATEXTRA A2 where A2.CODFIC_0 ='WORKSTATIO' AND A2.ZONE_0 = 'WSTSHOAXX' AND A2.LANGUE_0 = 'CHI' AND A2.IDENT2_0=:new.WCRFCY_0 AND A2.IDENT1_0 =:new.WST_0 ), NAME=(select AA.TEXTE_0 from ATEXTRA AA where AA.CODFIC_0 ='WORKSTATIO' AND AA.ZONE_0 = 'WSTDESAXX' AND AA.LANGUE_0 = 'CHI' AND AA.IDENT2_0=:new.WCRFCY_0 AND AA.IDENT1_0 = :new.WST_0), SBUNIT=(select AD.LANMES_0 from APLSTD AD where AD.LAN_0 ='CHI' AND AD.LANCHP_0 ='343' AND AD.LANNUM_0 = :new.WSTTYP_0),SBFL=:new.WCR_0, PID=(select gz.oid from GY_GZ@x3v6 gz where gz.code = :new.WCR_0) WHERE CODE=:NEW.WST_0; End;
2.
UPDATE_WORKSTATIO 触发器的名字
WORKSTATIO 被触发的表名字
AFTER UPDATE 在哪个动作之后
3.格式框架
create or replace trigger 触发器的名字 AFTER 什么动作触发(UPDATE,insert,delete。。)on 被触发的表名字 for each row begin
。。。。。。。触发后执行的语句
End;