How to use triggers in Oracle

Source: Internet
Author: User
Tags ssh
Previous work to do data synchronization used in the trigger, made the following notes, summarized as follows: Data center----------------------------------College Create or replace trigger TGER_XX_YXSDWJBSJZ L_ist before insert on ZFDXC. Xx_yxsdwjbsjzl for each row begin inserts into XGXT.ZXBZ_XXBMDM@DBLINK_DXCTOXGXT (BMDM,BMMC,BMJB,BMLB) VALUES (: NEW.DWH,:
new.dwmc,1,5);
End /create or Replace trigger Tger_xx_yxsdwjbsjzl_udt before update on ZFDXC. Xx_yxsdwjbsjzl for each row begin update xgxt.zxbz_xxbmdm@dblink_dxctoxgxt set BMDM=:NEW.DWH,BMMC=:NEW.DWMC where bmdm=
: OLD.DWH;
End /create or replace trigger Tger_xx_yxsdwjbsjzl_del before delete on ZFDXC.
Xx_yxsdwjbsjzl for each row begin delete Zxbz_xxbmdm@dblink_dxctoxgxt where BMDM=:OLD.DWH;
End /create or replace trigger TRIG_XYDMBTOJWGL after INSERT or DELETE or UPDATE of DWH,DWMC in Xx_yxsdwjbsjzl for each ROW B
        Egin IF inserting THEN insert into XYDMB@DBLINK_DXCTOJWGL (XYDM,XYMC) VALUES (: NEW.DWH,:NEW.DWMC);
    Insert into XYDMB@DBLINK_DXCTOZFOA (XYDM,XYMC) VALUES (: NEW.DWH,:NEW.DWMC); elsif DELETING THEN Delete from Xydmb@dblink_dxctojwgl where XYDM=:OLD.DWH;
          
   Delete from Xydmb@dblink_dxctozfoa where XYDM=:OLD.DWH;
      elsif updating THEN update XYDMB@DBLINK_DXCTOJWGL set XYDM=:NEW.DWH,XYMC=:NEW.DWMC where XYDM=:OLD.DWH;
   Update Xydmb@dblink_dxctozfoa set XYDM=:NEW.DWH,XYMC=:NEW.DWMC where XYDM=:OLD.DWH;
End IF;
End; /-----------------------------------------Professional Create or replace trigger tger_jx_zyxxsjl_ist before insert on Zfdxc.jx_ ZYXXSJL for each row begin inserts into BKS_ZYDM@DBLINK_DXCTOXGXT (ZYDM,BMDM,ZYMC,ZYJC,ZYYWMC) VALUES (: NEW.ZYH,:NEW.DWH,
: NEW.ZYMC,:NEW.ZYJC,:NEW.ZYYWMC);
End /create or Replace trigger Tger_jx_zyxxsjl_udt before update on ZFDXC.JX_ZYXXSJL for each row begin update Bks_zydm@dblin
K_DXCTOXGXT set ZYDM=:NEW.ZYH,BMDM=:NEW.DWH,ZYMC=:NEW.ZYMC,ZYJC=:NEW.ZYJC,ZYYWMC=:NEW.ZYYWMC where Zydm=:old.zyh;
End /create or replace trigger Tger_jx_zyxxsjl_del before delete on ZFDXC.JX_ZYXXSJL for each row begin delete Bks_zyDM@DBLINK_DXCTOXGXT where Zydm=:old.zyh;
End /---------------------------------------class Create or replace trigger tger_xx_bjsjl_ist before insert on ZFDXC.XX_BJSJL f or each row begin inserts into BKS_BJDM@DBLINK_DXCTOXGXT (BJDM,ZYDM,BMDM,BJMC,NJ) VALUES (: NEW.BH,:NEW.ZYH,:NEW.SSXYDM,:
NEW.BJ,:NEW.NJ);
End /create or Replace trigger Tger_xx_bjsjl_udt before update on ZFDXC.XX_BJSJL for each row begin update Bks_bjdm@dblink_dx
CTOXGXT set BJDM=:NEW.BH,ZYDM=:NEW.ZYH,BMDM=:NEW.SSXYDM,BJMC=:NEW.BJ,NJ=:NEW.NJ where bjdm=:old.bh;
End /create or replace trigger Tger_xx_bjsjl_del before delete on ZFDXC.XX_BJSJL for each row begin delete Bks_bjdm@dblink_d
XCTOXGXT where bjdm=:old.bh;
End /---------Staff basic data Create or replace trigger TRIG_JZGJCSJZL_JSXXB after insert or delete or update of JGH,DWH,XM
, XBM,CSRQ,JG,MZM,WHCDM,JZGLBM,ZW on Jg_jzgjcsjzl for each row declare V_BMMC varchar2 (100);
V_XB Dm_gb_rdxbdm.mc%type;
V_MZ VARCHAR2 (10);
V_WHCDMC VARCHAR2 (10); V_JZGLBMC VARCHAR2 (10);
Maxxh varchar2 (100);
Kyyhbid varchar2 (20);
Kyyhjbxxbid varchar2 (20);
BEGIN if:new.sjly= ' Dean ' then null;
      Else begin update Kyglxtsequence@zfky_dblink set Seqvalue=seqvalue + cachesize where seqname= ' seqyhbid ';
      Update Kyglxtsequence@zfky_dblink set Seqvalue=seqvalue + cachesize where seqname= ' seqyhjbxxbid ';
      Select Seqvalue into Kyyhbid from Kyglxtsequence@zfky_dblink where seqname= ' seqyhbid ';
Select Seqvalue into Kyyhjbxxbid from Kyglxtsequence@zfky_dblink where seqname= ' seqyhjbxxbid ';
End
Begin select DWMC into V_bmmc from Xx_yxsdwjbsjzl where DWH=:NEW.DWH;
Exception when others then v_bmmc:= '-9 ';
End
Begin select MC into V_XB from DM_GB_RDXBDM where DM=:NEW.XBM;
Exception when others then v_xb:= '-9 ';
End
Begin select MC into V_mz from DM_GB_ZGGMZDLMZMPXFHDM where DM=:NEW.MZM;
Exception when others then v_mz:= '-9 ';
End
Begin select MC into V_WHCDMC from DM_HB_WHCD where DM=:NEW.WHCDM; Exception when otheRS then v_whcdmc:= '-9 ';
End
Begin select To_char (To_number max (YHSX) + 1) into Maxxh from Bmryxxb@dblink_dxctozfoa where XYDM=:NEW.DWH;
Exception when others then maxxh:= '-9 ';
End Begin select MC into V_JZGLBMC from Dm_hb_jzglb where dm=:new.
JZGLBM;
Exception when others then v_jzglbmc:= '-9 ';
End If inserting then insert into JSXXB@DBLINK_DXCTOJWGL (zgh,bm,xm,xb,csrq,jg,mz,xl,lbmc,sjly) VALUES (: New.jgh,v_bmmc,:n
     EW.XM,V_XB,:NEW.CSRQ,:NEW.JG,V_MZ,V_WHCDMC,V_JZGLBMC, ' personnel '); Insert into BMRYXXB@DBLINK_DXCTOZFOA (XYDM,YHM,RYID,YHSX) VALUES (: NEW.DWH,:NEW.JGH,BMRYXX_RYID.NEXTVAL@DBLINK_
     DXCTOZFOA,MAXXH); Insert into Yhjbxxb@zfky_dblink (YHJBXXBID,XM,XBDMBID,JGDMBID,XZZW) VALUES (KYYHJBXXBID,:NEW.XM,:NEW.XBM,:NEW.DWH,:
     NEW.ZW); Insert into Yhb@zfky_dblink (YHBID,YHM,MM,YHLYBID,YHLYB,YHZT) VALUES (Kyyhbid,:new.jgh, ' u ', kyyhjbxxbid, ' yhjbxxb ', '
         
  1 ');
     elsif deleting then delete from JSXXB@DBLINK_DXCTOJWGL where zgh=:old.jgh; DelEte from Bmryxxb@dblink_dxctozfoa where Yhm=:old.jgh;
     Delete from Yhjbxxb@zfky_dblink where xm=:old.xm;
  Delete from Yhb@zfky_dblink where yhm=:old.jgh; elsif updating then update JSXXB@DBLINK_DXCTOJWGL set Zgh=:new.jgh,bm=v_bmmc,xm=:new.xm,xb=v_xb,csrq=:new.csrq,jg=:n
     EW.JG,MZ=V_MZ,XL=V_WHCDMC,LBMC=V_JZGLBMC where Zgh=:old.jgh;
     Update Bmryxxb@dblink_dxctozfoa set xydm=:new.dwh,yhm=:new.jgh,yhsx=maxxh where Yhm=:old.jgh;
     Update Yhjbxxb@zfky_dblink set XM=:NEW.XM where XM=:OLD.XM;
  Update Yhb@zfky_dblink set yhm=:new.jgh where Yhm=:old.jgh;
End If;
End If;
End /create or replace trigger TRIG_JZGJCSJZL_PORTALYHB after insert or delete or update of JGH,XM in Jg_jzgjcsjzl for each R
  ow BEGIN If inserting then insert into yhb@dblink_dxctoportal (YHM,KL,XM,YHLX) VALUES (: New.jgh, ' U ',: New.xm, ' 2 ');
  elsif deleting then delete from yhb@dblink_dxctoportal where yhm=:old.jgh; elsif updating then update yhb@dblink_dxctoportal set YHM=:NEW.JGH,XM=:NEW.XM where Yhm=:old.jgh;
End If;
End; 
/create or replace trigger TRIG_JZGJCSJZL_ZFOAYHB after insert or delete or update of JGH,XM in Jg_jzgjcsjzl for each row
  BEGIN if inserting then insert into YHB@DBLINK_DXCTOZFOA (YHM,KL,ZDM,XM,YHLX) VALUES (: New.jgh, ' u ', ' n ',: New.xm, ' 2 ');
  elsif deleting then delete from Yhb@dblink_dxctozfoa where yhm=:old.jgh;
  elsif updating then update YHB@DBLINK_DXCTOZFOA set YHM=:NEW.JGH,XM=:NEW.XM where Yhm=:old.jgh;
End If;
End; /create or replace trigger TRIG_ZYJSZW_JSXXB after insert or delete or update of PRZWM in Jg_zyjszwzl for each row declar
E V_PRZWMC varchar2 (100);
Begin begin select ZWXLMC into V_PRZWMC from DM_GB_ZYJSZWDM where DM=:NEW.PRZWM;
Exception when others then v_przwmc:= '-9 ';
     End
Update JSXXB@DBLINK_DXCTOJWGL set ZW=V_PRZWMC where Zgh=:new.jgh;
End; /create or replace trigger TRIG_ZZMM_JSXXB after insert or delete or update of zzmmm in JG_ZZMMSJL for each row declare v _ZZMMMC varchar2 (100);
Begin BEGIN SELECT MC into V_zzmmmc from DM_GB_ZZMMDM where dm=:new.zzmmm;
Exception when others then v_zzmmmc:= '-9 ';
     End
Update JSXXB@DBLINK_DXCTOJWGL set ZZMM=V_ZZMMMC where Zgh=:new.jgh;
End; /----------------------------------------------student Create or replace trigger tger_xs_xsjbsjzl_ist before insert on ZFDXC . Xs_xsjbsjzl for each row begin----Learning System student basic information INSERT into XGXT.BKS_XSJBXX@DBLINK_DXCTOXGXT (Xh,bmdm,bjdm,zydm,xm,xmpy, CYM,PYFS,XZ,RXNY,NJ,SFZH,XBM,XJZTM,XXNX,ZYFX,KSH,BZ,MM) VALUES (: new.xh, Case WHEN:NEW.XYMC in (select DWMC from Xx_ YXSDWJBSJZL) then (select Dwh from Xx_yxsdwjbsjzl where:new.xymc=dwmc) Else ' NU ' end), (Case WHEN:NEW.BJMC in (select BJ From XX_BJSJL) then (select BH from XX_BJSJL where:new.bjmc=bj) Else ' null ' end), (case WHEN:NEW.ZYDM is NULL then ' NU LL ' ELSE:NEW.ZYDM end),: New.xm,:new.xmpy,:new.cym,:new.pyfs,:new.xz,:new.rxrq,:new.nj,:new.sfzjh, (CASE:NEW.XB When ' male ' then 1 when ' female ' then 2 else 0 end),: NEW.XJZT,:NEW.XXNX,:NEW.ZYFX,:NEW.KSH,:NEW.BZ,:NEW.MM); ----Learning System Students other information insert into XGXT.BKS_XSQTXX@DBLINK_DXCTOXGXT (XH,MZDM,HKSZD,BYZX,LYDQ,CSRQ) VALUES (: NEW.XH,:NEW.MZM,
: NEW.JG,:NEW.BYZX,:NEW.LYDQ,:NEW.CSRQ);
----School system Student password table insert into XGXT.XSMMB@DBLINK_DXCTOXGXT (XH,MM) VALUES (: NEW.XH,:NEW.MM);
End /create or Replace trigger Tger_xs_xsjbsjzl_udt before update on ZFDXC.XS_XSJBSJZL to each row begin----Student basic information UPDA Te Xgxt.bks_xsjbxx@dblink_dxctoxgxt set xh=:new.xh,bmdm= (Case WHEN:NEW.XYMC in (select DWMC from Xx_yxsdwjbsjzl) then (SE Lect dwh from Xx_yxsdwjbsjzl where:new.xymc=dwmc) Else ' NU ' "End", bjdm= (Case WHEN:NEW.BJMC in (select BJ from XX_BJSJL) t Hen (select bh from XX_BJSJL where:new.bjmc=bj) Else ' null ' "End", zydm= (case WHEN:NEW.ZYDM is null then ' null ' else:n EW.ZYDM end), xm= (case when:new.xm are null then ' null ' ELSE:NEW.XM end), xmpy=:new.xmpy,cym=:new.cym,pyfs=:new.pyfs,xz=: NEW.XZ,RXNY=:NEW.RXRQ,NJ=:NEW.NJ,SFZH=:NEW.SFZJH, xbm= (case:new.xb when ' man ' then 1 when ' female ' then 2 else 0 end), xjztM=:NEW.XJZT,XXNX=:NEW.XXNX,ZYFX=:NEW.ZYFX,KSH=:NEW.KSH,BZ=:NEW.BZ,MM=:NEW.MM where xh=:old.xh; ----Learning System Students Other information update XGXT.BKS_XSQTXX@DBLINK_DXCTOXGXT set XH=:NEW.XH,MZDM=:NEW.MZM,HKSZD=:NEW.JG,BYZX=:NEW.BYZX,
LYDQ=:NEW.LYDQ,CSRQ=:NEW.CSRQ where xh=:old.xh;
End /create or replace trigger Tger_xs_xsjbsjzl_del before delete on Zfdxc.xs_xsjbsjzl for each row begin delete XGXT.BKS_XSJ
BXX@DBLINK_DXCTOXGXT where xh=:old.xh;
Delete Xgxt.bks_xsqtxx@dblink_dxctoxgxt where xh=:old.xh;
Delete Xgxt.xsmmb@dblink_dxctoxgxt where xh=:old.xh;
End 
/------------------------------------------------------------------------------------------------------------Personnel Create or replace trigger TRIG_XYDMBTOZFDXC after INSERT or DELETE or UPDATE of Code,info on dm_def_org for each ROW Begi
    N IF inserting THEN insert into XX_YXSDWJBSJZL@MEDI_DBLINK_ZFDXC (DWH,DWMC) VALUES (: New.code,:new.info);
   elsif deleting THEN delete from xx_yxsdwjbsjzl@medi_dblink_zfdxc where Dwh=:old.code; elsif Updating THEN Update XX_YXSDWJBSJZL@MEDI_DBLINK_ZFDXC set dwh=:new.code,dwmc=:new.info where Dwh=:old.code;
End IF;
End; /CREATE or REPLACE TRIGGER trig_overall after INSERT or DELETE or UPDATE--of x__staffid,x__name,x__namespell,x__oldname, X__birthday,x__sex,x__nationality,x__nation,x__nativeplace,x__bornplace,x__idcard,x__worktime,x__healthstate,x __bloodtype,x__colony,x__marriagestate,x__origin,x__personstation,x__fileno,x__joincollegetime,x__org,x__ Educationlevel,x__authsort,x__staffsort on overall for each ROW BEGIN IF inserting THEN insert INTO JG_JZGJCSJZ L@MEDI_DBLINK_ZFDXC (jgh,xm,xmpy,cym,csrq,xbm,gjm,mzm,jg,csdm,sfzjh,cjgzny,jkzkm,xxm,gatqwm,hyzkm,jtcsm,brcfm, DABH,LXRQ,DWH,WHCDM,BZLBM,JZGLBM,MM,XJXDM,ZGXL,ZGXW,RDSJ,RZWSJ) VALUES (: New. X__staffid,:new. X__name,:new. X__namespell,:new. X__oldname,:new. X__birthday,:new. X__sex,:new. X__nationality,:new. X__nation,:new. X__nativeplace,:new. X__bornplace,:new. X__idcard,:new. X__worktime,:new. X__healthstate,:new. X__bloodType,:new. X__colony,:new. X__marriagestate,:new. X__origin,:new. X__personstation,:new. X__fileno,:new. X__joincollegetime,:new. X__org,:new. X__educationlevel,:new. X__authsort,:new. X__staffsort, ' U ',: New. X__fileno,:new. X__educationlevel,:new. X__degree,:new. X__joindate,:new.
       X__appointdate); Insert into JG_ZYJSZWZL@MEDI_DBLINK_ZFDXC (JGH,RZZGMCM,PRZWM) VALUES (: New. X__staffid,:new. X__majorqualification,:new.
       X__appointduty); Insert into JG_ZZMMSJL@MEDI_DBLINK_ZFDXC (JGH,ZZMMM,CJRQ) VALUES (: New. X__staffid,:new. X__politics,:new.
   X__joindate); elsif deleting THEN delete from Jg_jzgjcsjzl@medi_dblink_zfdxc where jgh=:old.
      X__staffid; Delete from Jg_zyjszwzl@medi_dblink_zfdxc where jgh=:old.
      X__staffid; Delete from Jg_zzmmsjl@medi_dblink_zfdxc where jgh=:old.
   X__staffid; elsif updating THEN update JG_JZGJCSJZL@MEDI_DBLINK_ZFDXC set jgh=:new. X__staffid,xm=:new. X__name,xmpy=:new. X__namespell,cym=:new. X__oldname,csrq=:new. X__birthday,xbm=:new. X__sex,gjm=:new. X__nationality,mzm=:new. X__nation,jg=:new. X__nativeplace,csdm=:new. X__bornplace,sfzjh=:new. X__idcard,cjgzny=:new. X__worktime,jkzkm=:new. X__healthstate,xxm=:new. X__bloodtype,gatqwm=:new. X__colony,hyzkm=:new. X__marriagestate,jtcsm=:new. X__origin,brcfm=:new. X__personstation,dabh=:new. X__fileno,lxrq=:new. X__joincollegetime,dwh=:new. X__org,whcdm=:new. X__educationlevel,bzlbm=:new. X__authsort,jzglbm=:new. X__staffsort,xjxdm=:new. X__fileno,zgxl=:new. X__educationlevel,zgxw=:new. X__degree,rdsj=:new. X__joindate,rzwsj=:new. X__appointdate where Jgh=:old.
      X__staffid; Update JG_ZYJSZWZL@MEDI_DBLINK_ZFDXC set jgh=:new. X__staffid,rzzgmcm=:new. X__majorqualification,przwm=:new. X__appointduty where Jgh=:old.
      X__staffid; Update JG_ZZMMSJL@MEDI_DBLINK_ZFDXC set jgh=:new. X__staffid,zzmmm=:new. X__politics,cjrq=:new. X__joindate where Jgh=:old.
   X__staffid;
End IF;
End; /
-------------------------------------------------------------------------------------------------------------- ------Academic---Campus create or replace trigger tger_xqdm_ist before insert on ZFXFZB.XQDMB for each row begin inserts into XX_XQJBSJZL@DBLINK_JWGLTODX
C (XQH,XQM) VALUES (: NEW.XQDM,:NEW.XQMC);
End /create or Replace trigger Tger_xqdm_udt before update on ZFXFZB.XQDMB for each row begin update XX_XQJBSJZL@DBLINK_JWGLT
ODXC set XQH=:NEW.XQDM,XQM=:NEW.XQMC where XQH=:OLD.XQDM;
End /create or replace trigger Tger_xqdm_del before delete on ZFXFZB.XQDMB for each row begin delete Xx_xqjbsjzl@dblink_jwgl
TODXC where XQH=:OLD.XQDM;
End ---Professional create or replace trigger tger_zydm_ist before insert on ZFXFZB.ZYDMB for each row begin inserts into Jx_zyxxsjl@dbli NK_JWGLTODXC (Zyh,zymc,zyjc,zyywmc,dwh,xz,bzkzym) VALUES (: NEW.ZYDM,:NEW.ZYMC,:NEW.ZYJC,:NEW.ZYYWMC,:NEW.SSXYDM,:
NEW.XZ,:NEW.TJZYDM);
End /create or Replace trigger Tger_zydm_udt before update on ZFXFZB.ZYDMB for each row begin update Jx_zyxxsjl@dblink_jwglto DXC Set Zyh=:new.zydm,zymc=:new.zymc,zyjc=:new.zyjc,zyywmc=:new.zyywmc,dwh=:new.ssxydm,xz=:new.xz,bzkzym=:new. SSXYDM where ZYH=:OLD.ZYDM;
End /create or replace trigger Tger_zydm_del before delete on ZFXFZB.ZYDMB for each row begin delete JX_ZYXXSJL@DBLINK_JWGLT
ODXC where ZYH=:OLD.ZYDM;
End /---Class create or replace trigger tger_bjdm_ist before insert on ZFXFZB.BJDMB for each row begin inserts into Xx_bjsjl@dbli NK_JWGLTODXC (BH,BJ,BZRJGH,FDYH,ZYH,BJJC,ZYFX,SSXYDM,NJ,SSXQDM,XZ,CC) VALUES (: New.bjdm,:new.bjmc,:new.bzrzgh,:
new.fdyxm,:new.sszydm,:new.bjjc,:new.zyfx,:new.ssxydm,:new.nj,:new.ssxqdm,:new.xz,:new.cc);
End /create or Replace trigger Tger_bjdm_udt before update on ZFXFZB.BJDMB for each row begin update Xx_bjsjl@dblink_jwgltodx C Set Bh=:new.bjdm,bj=:new.bjmc,bzrjgh=:new.bzrzgh,fdyh=:new.fdyxm,zyh=:new.sszydm,bjjc=:new.bjjc,zyfx=:new.zyfx
, ssxydm=:new.ssxydm,nj=:new.nj,ssxqdm=:new.ssxqdm,xz=:new.xz,cc=:new.cc where BH=:OLD.BJDM;
End /create or replace trigger Tger_bjdm_del before delete on ZFXFZB.BJDMB for each row begin delete Xx_bjsjl@dblink_jwgltod
XC where BH=:OLD.BJDM;
End
/--Student Create or replace trigger tger_xsjbxx_ist before insert on ZFXFZB.XSJBXXB to each row declare V_BJDM varchar2 (5
0);
V_XYDM VARCHAR2 (50);
Begin begin select XYDM into V_XYDM from XYDMB where Xymc=:new.xy;
Exception when others then v_xydm:= ' 9 ';
End
Begin select Bjdm into V_BJDM from BJDMB where BJMC=:NEW.XZB;
Exception when others then v_bjdm:= ' 9 ';
End ----Data center Student basic data subclass INSERT into ZFDXC.XS_XSJBSJZL@DBLINK_JWGLTODXC (XH,XM,XMPY,CYM,CSRQ,JG,SFZJH,XYMC,ZYDM,ZYMC,BJMC, Mz,pyfs,ksh,xxnx,xz,xb,zyfx,pyfx,xjzt,sfzx,sfzc,bz,nj,rxrq,lydq,byzx,ssh,dzyxdz,lxdh,zkzh,jtszd,sflxs, TELNUMBER,TELLX,CC,YZBM,RXZF,YYCJ,ZZMM,MM) VALUES (: NEW.XH,:NEW.XM,:NEW.XMPY,:NEW.ZYM,:NEW.CSRQ,:NEW.JG,: NEW.SFZH,:NEW.XY,:NEW.ZYDM,:NEW.ZYMC,:NEW.XZB,:NEW.MZ,:NEW.XXXS,:NEW.KSH,:NEW.XXNX,:NEW.XZ,:NEW.XB,:NEW.ZYFX,: New.pyfx,:new.xjzt,:new.sfzx,:new.sfzc,:new.bz,:new.dqszj,:new.rxrq,:new. Lydq,:new. Byzx,:new. Ssh,:new. Dzyxdz,:new. Lxdh,:new. Zkzh,:new. Jtszd,:new. Sflxs,:new. Telnumber,:new. Tellx,:new. Cc,:new. YzbM,:new. Rxzf,:new.
YYCJ,:NEW.ZZMM,:NEW.MM); ----Data Center basic data subclass insert into ZFDXC.XS_XJJBSJZL@DBLINK_JWGLTODXC (XH,YXSH,ZYM,BH) VALUES (: new.xh,v_xydm,:new.zydm,v_
BJDM);
End 
/create or Replace trigger Tger_xsjbxx_udt before update on ZFXFZB.XSJBXXB to each row declare V_BJDM varchar2 (50);
V_XYDM VARCHAR2 (50);
Begin----Data Center student basic data subclass begin select XYDM into V_XYDM from XYDMB where Xymc=:new.xy;
Exception when others then v_xydm:= ' 9 ';
End
Begin select Bjdm into V_BJDM from BJDMB where BJMC=:NEW.XZB;
Exception when others then v_bjdm:= ' 9 ';
End Update XS_XSJBSJZL@DBLINK_JWGLTODXC Set xh=:new.xh,xm=:new.xm,xmpy=:new.xmpy,cym=:new.zym,csrq=:new.csrq,jg=: New.jg,sfzjh=:new.sfzh,xymc=:new.xy,zydm=:new.zydm,zymc=:new.zymc,bjmc=:new.xzb,mz=:new.mz,pyfs=:new.xxxs,ksh= : NEW.KSH,XXNX=:NEW.XXNX,XZ=:NEW.XZ,XB=:NEW.XB,ZYFX=:NEW.ZYFX,PYFX=:NEW.PYFX,XJZT=:NEW.XJZT,SFZX=:NEW.SFZX,SFZC =:new.sfzc,bz=:new.bz,nj=:new.dqszj,rxrq=:new.rxrq,lydq=:new. Lydq,byzx=:new. Byzx,ssh=:new. Ssh,dzyxdz=:new. DzyXdz,lxdh=:new. Lxdh,zkzh=:new. Zkzh,jtszd=:new. Jtszd,sflxs=:new. Sflxs,telnumber=:new. Telnumber,tellx=:new. Tellx,cc=:new. Cc,yzbm=:new. Yzbm,rxzf=:new. Rxzf,yycj=:new.
YYCJ,ZZMM=:NEW.ZZMM,MM=:NEW.MM where xh=:old.xh; ----Data Center basic Data Subclass View This column more highlights: Http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/update Xs_
XJJBSJZL@DBLINK_JWGLTODXC set XH=:NEW.XH,YXSH=V_XYDM,ZYM=:NEW.ZYDM,BH=V_BJDM where xh=:old.xh;
End /create or replace trigger Tger_xsjbxx_del before delete on ZFXFZB.XSJBXXB for each row begin delete Xs_xsjbsjzl@dblink_
JWGLTODXC where xh=:old.xh;
Delete Xs_xjjbsjzl@dblink_jwgltodxc where xh=:old.xh;
End
    
/--External teacher create or replace trigger TRIG_WPJS_ZFDXC after insert or delete or update of ZGH,XM,BM in JSXXB for each row
DECLARE V_BMDM VARCHAR2 (10);
Len number;
Begin SELECT COUNT (Jgh) into the Len from JG_JZGJCSJZL@DBLINK_JWGLTODXC where Jgh=:old.zgh and sjly= ' personnel '; If len=0 and:new.sjly| | ' A ' <> ' personnel a ' then--No personnel data begin select XYDM into V_BMDM from XYDMB where xymc=:NEW.BM;
Exception when others then v_bmdm:= '-9 ';
  End
  If inserting then insert into JG_JZGJCSJZL@DBLINK_JWGLTODXC (jgh,xm,dwh,sjly) VALUES (: NEW.ZGH,:NEW.XM,V_BMDM, ' Dean ');
  elsif deleting then delete from jg_jzgjcsjzl@dblink_jwgltodxc where jgh=:old.zgh;
  elsif updating then update JG_JZGJCSJZL@DBLINK_JWGLTODXC set JGH=:NEW.ZGH,XM=:NEW.XM,DWH=V_BMDM where Jgh=:old.zgh;
End If;
End If;
    
End /
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.