日期:2014-05-17  浏览次数:20756 次

急!!!!!!!~~~~~~~这个触发器怎么写!
create table a 
(
  a number(2),
  id number(2)
)
create table b
(
  b number(2),
  id number(2)
)
insert into a (a,id)values(1,9)
insert into b (b,id)values(2,9)


create trigger a_update
before update of a on a
referencing old as old_value
new as new_value
for each row
begin
:new_value.id:=5;
end

 
 drop trigger a_update;
 
update a set a=5

select *
from a

select*
from b

我想把a表中的a字段改为5,同时b表中的b字段也变成5

------解决方案--------------------
探讨
SQL code
create trigger a_update_trig
before update of a on a
for each row
begin
--:new.id:=5;
insert into a(a,id)values(5,:new.id);
commit;
update b set b=5 where id=:new.id;
commit;
end a……