create or replace trigger zcfb
  before insert or update
  ON a10
      referencing old as old
                new as new
  FOR EACH ROWDECLARE
  BEGIN
  if  inserting then
     if :new.a1006 = '1' then
        update a10 set a1006 = '0' where a01_key = :new.a01_key and a_id <> :new.a_id;
     end if;
  end if;
  if updating then
     if :new.a1006 = '1' then
        update a10 set a1006 = '0' where a01_key = :new.a01_key and a_id <> :new.a_id;
     end if;
  end if;
  END;这个是我写的触发器 执行的时候提示A10 发生了变化,触发器不能读他

解决方案 »

  1.   

    在a10表上建立的触发器,不要在触发器内部试图修改它自己!!
    触发器中不要用来完成这种任务。
    create or replace trigger zcfb
      before insert or update
      ON a10
      referencing old as old
      new as new
      FOR EACH ROWDECLARE
      BEGIN
      if inserting then
      if :new.a1006 = '1' then
      update a10 set a1006 = '0' where a01_key = :new.a01_key and a_id <> :new.a_id;
      end if;
      end if;
      if updating then
      if :new.a1006 = '1' then
      update a10 set a1006 = '0' where a01_key = :new.a01_key and a_id <> :new.a_id;
      end if;
      end if;