2 lcm zg lcm_zg 于 2016.05.09 21:35 提问

oracle 插删改 触发器

create or replace trigger TG_attend_417
after insert or delete or update on attend_417
for each row
begin
if inserting then
if :new.attendance = 'la' then update stud_417 set sum_evaluation = sum_evaluation-2;

elsif :new.attendance = 't' then update stud_417 set sum_evaluation = sum_evaluation-5;
else :new.attendance = 'le' then update stud_417 set sum_evaluation = sum_evaluation-1;
end if;
end if;
if deleting then
if :old.attendance = 'la' then update stud_417 set sum_evaluation = sum_evaluation+2;
elsif :old.attendance = 't' then update stud_417 set sum_evaluation = sum_evaluation+5;
else :old.attendance = 'le' then update stud_417 set sum_evaluation = sum_evaluation+1;
end if;
end if;
if updating then
if :new.attendance = 'la' then update stud_417 set sum_evaluation = sum_evaluation-2;
elsif :new.attendance = 't' then update stud_417 set sum_evaluation = sum_evaluation-5;
else :new.attendance = 'le' then update stud_417 set sum_evaluation = sum_evaluation-1;
end if;
end if;
end;
.
/
show errors;

请问哪里错了?

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!