建userlogin 表,再建一个一样的表 userlogin_bak,userlogin做删除修改事务时,触发userlogin_bak做相应的事务
create or replace trigger tr_userlogin after insert or update or delete
on userlogin for each row
begin
if inserting then
insert into userlogin_bak values(nnnn.nextval,:new.username,encrypt_des(:new.password,'feng111111'));
elsif updating then
update userlogin_bak set uno=:new.uno,username=:new.username,password=encrypt_des(:new.password,'feng111111') where uno=:old.uno;
elsif deleting then
delete from userlogin_bak where uno=:old.uno;
end if;
end;
/
insert into userlogin
values(22,'test122','test22');
commit;
update userlogin
set username='test111'--,password='test222'
where uno=23;
delete from userlogin where uno=1111;
commit;