create trigger update_checking
before update on check_body
for each row
begin
if new.high>2 then
new.high:=old.high;
raise_application_error(-10345,'He(or She) is too tall');
end if;
if new.weight>100 then
new.weight:=old.weight;
raise_application_error(-10346,'He(or She) is too fat');
end if;
end update_checking;
before update on check_body
for each row
begin
if new.high>2 then
new.high:=old.high;
raise_application_error(-10345,'He(or She) is too tall');
end if;
if new.weight>100 then
new.weight:=old.weight;
raise_application_error(-10346,'He(or She) is too fat');
end if;
end update_checking;
after update on check_body
for each row
begin
if new.high>2 then
new.high := :old.high;--出现new和old的时候要用‘:’;
raise_application_error(-10345,'He(or She) is too tall');
end if;
if new.weight>100 then
new.weight := :old.weight;
raise_application_error(-10346,'He(or She) is too fat');
end if;
end update_checking;
我是把你的after 改成了 before,这两个谓词肯定是有区别的。
楼上师兄把你的改成了:before update on check_bodyUP!
after update on check_body
for each row
begin
if :new.high>2 then
:new.high := :old.high;--出现new和old的时候要用‘:’;
raise_application_error(-10345,'He(or She) is too tall');
end if;
if :new.weight>100 then
:new.weight := :old.weight;
raise_application_error(-10346,'He(or She) is too fat');
end if;
end update_checking;
我已经调试过了,可以的,你把你执行的语句和错误贴出来看看!
create trigger update_checking
before update on check_body
for each row
begin
if :new.high>2 then
:new.high:=:old.high;
raise_application_error(-10345,'He(or She) is too tall');
end if;
if :new.weight>100 then
:new.weight:=:old.weight;
raise_application_error(-10346,'He(or She) is too fat');
end if;
end update_checking;
如果还有编译错误,那就
SQL>show errors --查看详细错误