Oracle触发器设置

CREATE OR REPLACE TRIGGER T_P2_EHEALTH_CHECKOFLK_SYNC
--监测三种状态
       BEFORE INSERT OR DELETE OR UPDATE OF
      ANAL,
BREATH,
CARDNO,
CHECKOFLKID,
CHECKTIME,
CHO,
CRTIME,
CRUSER,
DBP,
DEVICESN,
DEVICETYPE,
ETCFILEPATH3,
ETCFILEPATH4,
ETCFILEPATH5,
ETC_REPORT_PATH,
ETC_REPORT_PATH_DATBAS,
FETALHEART,
FLAG,
GLU,
HDL,
HEIGHT,
ICPCODE,
LDL,
MEAN,
MEMO1,
MEMO2,
MEMO3,
MEMO4,
MEMO5,
MEMO6,
NCG_BIL,
NCG_BLO,
NCG_GLU,
NCG_KET,
NCG_LEU,
NCG_NIT,
NCG_PH,
NCG_PRO,
NCG_SG,
NCG_UBG,
NCG_VC,
NUMBEROFCASE,
OXIMETER,
PRODUCER,
PULSE,
SBP,
TEMP,
TG,
WEIGHT
 ON P2_EHEALTH_ARCH_CHECKOFLK
FOR EACH ROW
DECLARE V_DEVICE VARCHAR2(50);
BEGIN
  IF INSERTING THEN
    INSERT INTO P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS(
    ANAL,
BREATH,
CARDNO,
CHECKOFLKID,
CHECKTIME,
CHO,
CRTIME,
CRUSER,
DBP,
DEVICESN,
DEVICETYPE,
ETCFILEPATH3,
ETCFILEPATH4,
ETCFILEPATH5,
ETC_REPORT_PATH,
ETC_REPORT_PATH_DATBAS,
FETALHEART,
FLAG,
GLU,
HDL,
HEIGHT,
ICPCODE,
LDL,
MEAN,
MEMO1,
MEMO2,
MEMO3,
MEMO4,
MEMO5,
MEMO6,
NCG_BIL,
NCG_BLO,
NCG_GLU,
NCG_KET,
NCG_LEU,
NCG_NIT,
NCG_PH,
NCG_PRO,
NCG_SG,
NCG_UBG,
NCG_VC,
NUMBEROFCASE,
OXIMETER,
PRODUCER,
PULSE,
SBP,
TEMP,
TG,
WEIGHT
    )
VALUES(
:NEW.ANAL,
:NEW.BREATH,
:NEW.CARDNO,
ARCH_CHECKOFLK_SEQ1.nextval@dblink_hys,
:NEW.CHECKTIME,
:NEW.CHO,
:NEW.CRTIME,
:NEW.CRUSER,
:NEW.DBP,
:NEW.DEVICESN,
:NEW.DEVICETYPE,
:NEW.ETCFILEPATH3,
:NEW.ETCFILEPATH4,
:NEW.ETCFILEPATH5,
:NEW.ETC_REPORT_PATH,
:NEW.ETC_REPORT_PATH_DATBAS,
:NEW.FETALHEART,
:NEW.FLAG,
:NEW.GLU,
:NEW.HDL,
:NEW.HEIGHT,
:NEW.ICPCODE,
:NEW.LDL,
:NEW.MEAN,
:NEW.MEMO1,
:NEW.MEMO2,
:NEW.MEMO3,
:NEW.MEMO4,
:NEW.MEMO5,
:NEW.MEMO6,
:NEW.NCG_BIL,
:NEW.NCG_BLO,
:NEW.NCG_GLU,
:NEW.NCG_KET,
:NEW.NCG_LEU,
:NEW.NCG_NIT,
:NEW.NCG_PH,
:NEW.NCG_PRO,
:NEW.NCG_SG,
:NEW.NCG_UBG,
:NEW.NCG_VC,
:NEW.NUMBEROFCASE,
:NEW.OXIMETER,
:NEW.PRODUCER,
:NEW.PULSE,
:NEW.SBP,
:NEW.TEMP,
:NEW.TG,
:NEW.WEIGHT
);

ELSIF UPDATING THEN
DELETE FROM P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS WHERE NUMBEROFCASE = :OLD.NUMBEROFCASE AND CARDNO = :OLD.CARDNO AND DEVICESN = :OLD.DEVICESN AND CRTIME = :OLD.CRTIME;

INSERT INTO P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS(
       ANAL,
BREATH,
CARDNO,
CHECKOFLKID,
CHECKTIME,
CHO,
CRTIME,
CRUSER,
DBP,
DEVICESN,
DEVICETYPE,
ETCFILEPATH3,
ETCFILEPATH4,
ETCFILEPATH5,
ETC_REPORT_PATH,
ETC_REPORT_PATH_DATBAS,
FETALHEART,
FLAG,
GLU,
HDL,
HEIGHT,
ICPCODE,
LDL,
MEAN,
MEMO1,
MEMO2,
MEMO3,
MEMO4,
MEMO5,
MEMO6,
NCG_BIL,
NCG_BLO,
NCG_GLU,
NCG_KET,
NCG_LEU,
NCG_NIT,
NCG_PH,
NCG_PRO,
NCG_SG,
NCG_UBG,
NCG_VC,
NUMBEROFCASE,
OXIMETER,
PRODUCER,
PULSE,
SBP,
TEMP,
TG,
WEIGHT
    )
VALUES(
:NEW.ANAL,
:NEW.BREATH,
:NEW.CARDNO,
ARCH_CHECKOFLK_SEQ1.nextval@dblink_hys,
:NEW.CHECKTIME,
:NEW.CHO,
:NEW.CRTIME,
:NEW.CRUSER,
:NEW.DBP,
:NEW.DEVICESN,
:NEW.DEVICETYPE,
:NEW.ETCFILEPATH3,
:NEW.ETCFILEPATH4,
:NEW.ETCFILEPATH5,
:NEW.ETC_REPORT_PATH,
:NEW.ETC_REPORT_PATH_DATBAS,
:NEW.FETALHEART,
:NEW.FLAG,
:NEW.GLU,
:NEW.HDL,
:NEW.HEIGHT,
:NEW.ICPCODE,
:NEW.LDL,
:NEW.MEAN,
:NEW.MEMO1,
:NEW.MEMO2,
:NEW.MEMO3,
:NEW.MEMO4,
:NEW.MEMO5,
:NEW.MEMO6,
:NEW.NCG_BIL,
:NEW.NCG_BLO,
:NEW.NCG_GLU,
:NEW.NCG_KET,
:NEW.NCG_LEU,
:NEW.NCG_NIT,
:NEW.NCG_PH,
:NEW.NCG_PRO,
:NEW.NCG_SG,
:NEW.NCG_UBG,
:NEW.NCG_VC,
:NEW.NUMBEROFCASE,
:NEW.OXIMETER,
:NEW.PRODUCER,
:NEW.PULSE,
:NEW.SBP,
:NEW.TEMP,
:NEW.TG,
:NEW.WEIGHT
);

ELSIF DELETING THEN
  DELETE FROM P2_EHEALTH_ARCH_CHECKOFLK@DBLINK_HYS WHERE NUMBEROFCASE = :OLD.NUMBEROFCASE AND CARDNO = :OLD.CARDNO AND DEVICESN = :OLD.DEVICESN AND CRTIME = :OLD.CRTIME;

 END IF;
 END T_P2_EHEALTH_CHECKOFLK_SYNC;
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值