复制代码
1
在一个表(User_Info_2017 )上放置一个触发器;
当对它进行insert,update,delete的操作时,触发器(UserToTemp )启动,
把相应的变动数据根据需要放到另外一个表(User_Info_2017_temp )中;
触发器代码如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22create or replace trigger UserToTemp after insert or update or delete on User_Info_2017 for each row declare integrity_error exception; errno integer; errmsg char(200); dummy integer; found boolean; begin if inserting then insert into User_Info_2017_temp(ID,UserName,PassWord,CreateDate,Status) values(:NEW.ID,:NEW.UserName,:NEW.PassWord,:new.CreateDate,:NEW.Status); elsif updating then update User_Info_2017_temp set ID=:NEW.ID,UserName=:NEW.UserName,PassWord=:NEW.PassWord,Status=:NEW.Status where id=:OLD.id; elsif deleting then delete from User_Info_2017_temp where id=:OLD.id; end if; exception when integrity_error then raise_application_error(errno, errmsg); end;
最后
以上就是激情鸵鸟最近收集整理的关于oracle中表insert or update or delete触发器的全部内容,更多相关oracle中表insert内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复