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 表示出勤类别
请问要怎么修改才是正确的?