当两张表的两个不同字段值相等,把第二张表的另一个字段置为true的触发器怎么写?
------解决方案--------------------
create or replace trigger tri_upd
after insert on tablename1
for each row
declare
cursor mycur is select * from tablename2;
myrec tablename2%rowtype;
begin
open mycur;--打开游标
fetch mycur into myrec;
while mycur%found loop
fetch mycur into myrec;
if(myrec.columnname2=:new.columnname1) then
update tablename2 set flag=true where id=myrec.id;
commit;
end if;
end loop;
close mycur;
end;