TZMLAY 2016-05-09 13:35 采纳率: 100%
浏览 385

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;

请问哪里错了?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大