Oracle
-- 成员监听触发器 添加该人数据前删该人的旧数据
drop trigger if exists del_before_add;
delimiter $
create trigger del_before_add
before insert on 表名
for each row
begin
delete from 表名 where 身份证号码字段 = :new.身份证号码字段;
end
$
delimiter ;
Mysql
-- 成员监听触发器
-- 定时器 添加成员
drop trigger if exists t_user_add;
delimiter $
create trigger t_user_add
before insert on ORGUSER
for each row
begin
DECLARE compnay_name varchar(255);
set compnay_name = updateDep(new.DEPARTMENTID);
set new.COMPANYNAMES = compnay_name;
insert into APP_ORG_LISTENER values(null,2,0,new.ID,new.ROLEID,unix_timestamp(now()),1);
end
$
delimiter ;