问题描述
- oracle 触发器 插删改
-
create or replace trigger TG_attend_417 before delete or insert or update on attend_417 for each row begin if inserting then update stud set sum_evaluation = sum_evaluation-2*(select count(*)from attend_417 where (attendance = 'la')-5*(select count(*)from attend_417 where attendance = 't')-1*(select count(*)from attend_417 where attendance = 'le') where sno=:new.sno; end if; if deleting then update stud set sum_evaluation = sum_evaluation-2*(select count(*)from attend_417 where (attendance = 'la')-5*(select count(*)from attend_417 where attendance = 't')-1*(select count(*)from attend_417 where attendance = 'le') where sno = :old.sno; end if; if updating then update stud set sum_evaluation = sum_evaluation-2*(select count(*)from attend_417 where (attendance = 'la')-5*(select count(*)from attend_417 where attendance = 't')-1*(select count(*)from attend_417 where attendance = 'le') where sno = :old.sno; end if; end;
这是代码,la表示迟到,扣2分,t表示旷课,扣5分,le表示请假,扣1分,attendance 表示出勤类别
请问要怎么修改才是正确的?
解决方案
http://blog.csdn.net/indexman/article/details/8023740/
http://blog.csdn.net/justdo2008/article/details/4137779
时间: 2024-09-24 08:43:55