各位我想實現如下功能,即在一個表的TRIGGER中改動自己的記錄,SQL SERVER是可以的,可是ORACLE不行,報ORA-04091的錯,請問該如何解決???create or replace trigger TR_CONTINENT
  after INSERT OR update on continent  
  for each row
declare
  -- local variables here
begin
      
  IF INSERTING THEN
    Update Continent Set Revise=0,Last_Updat=Sysdate
         Where Continent.COM_ID= :NEW.COM_ID AND Continent.Cont_Code= :NEW.CONT_CODE;
  ELSE    
    Update Continent Set Revise=Revise+1,Last_Updat=Sysdate
         Where Continent.COM_ID= :NEW.COM_ID AND Continent.Cont_Code= :NEW.CONT_CODE;
  END IF;
end TR_CONTINENT;

解决方案 »

  1.   

    直接修改New的值就可以了:
    create or replace trigger TR_CONTINENT
      after INSERT OR update on continent  
      for each row
    declare
      -- local variables here
    begin
          
      IF INSERTING THEN
        :New.Revise=0;
        :New.Last_Updat = sysdate;
      ELSE    
        :New.Revise=:New.Revise+1;
        :New.Last_Updat = sysdate;
      END IF;
    end TR_CONTINENT;
      

  2.   

    謝了,大哥,我用你的方法在BEFORE的TRIGGER中就行了.