-- update 操作的触发器例子
drop trigger if exists csf_maec.tri_economic_dt_update;
delimiter |
create trigger csf_maec.tri_economic_dt_update after update on csf_maec.maec_data
for each row begin
insert into csf_maec.maec_data_ecnomic(
data_id, data_value, audit_status, data_notes, insert_user,
insert_time, update_user, update_time, delete_user, delete_time,
audit_user, audit_time, op_flag
)
select new.data_id, new.data_value, new.audit_status, new.data_notes, new.insert_user,
new.insert_time, new.update_user, now(), new.delete_user, new.delete_time,
new.audit_user, new.audit_time, concat('update ',user());
end|
delimiter ;
-- insert操作的触发器例子
drop trigger if exists csf_maec.tri_economic_dt_insert;
delimiter |
create trigger csf_maec.tri_economic_dt_insert after insert on csf_maec.maec_data
for each row begin
insert into csf_maec.maec_data_ecnomic(
data_id, data_value, audit_status, data_notes, insert_user,
insert_time, update_user, update_time, delete_user, delete_time,
audit_user, audit_time, op_flag
)
select new.data_id, new.data_value, new.audit_status, new.data_notes, new.insert_user,
new.insert_time, new.update_user, new.update_time, new.delete_user, new.delete_time,
new.audit_user, new.audit_time, concat('insert ',user());
end|
delimiter ;
-- delete操作的触发器例子
drop trigger if exists csf_maec.tri_economic_dt_delete;
delimiter |
create trigger csf_maec.tri_economic_dt_delete after delete on csf_maec.maec_data
for each row begin
insert into csf_maec.maec_data_ecnomic(
data_id, data_value, audit_status, data_notes, insert_user,
insert_time, update_user, update_time, delete_user, delete_time,
audit_user, audit_time, op_flag
)
select old.data_id, old.data_value, old.audit_status, old.data_notes, old.insert_user,
old.insert_time, old.update_user, old.update_time, old.delete_user, now(),
old.audit_user, old.audit_time, concat('delete ',user());
end|
delimiter ;
阅读(4278) | 评论(0) | 转发(0) |