create or replace trigger after_table1
after insert or update or delete
on table1
for each row
begin
end;
建了个触发器,对表操作时报错,“触发器无效且未通过重新验证”,找不到问题点,将触发器精简成如上代码依旧报这个错误,请帮忙看看有可能是哪儿的问题

解决方案 »

  1.   

    我是用的pl/sql,编译的时候没有报错,不知道你这儿说的工具是什么工具啊?
      

  2.   


    create trigger trg_test
    on table1
    for insert
    as
    beginend
      

  3.   

    create or replace trigger after_table1
    after insert or update or delete
    on table1
    for each row is
    begin
    end;
    还有是 insert 里面 不能出现 :old.   delete 里面不能出现 :new.
    所以你的三个写在一起应该是会出问题的。
      

  4.   

    那如果我要是既需要insert又需要delete,该怎么写呢?
      

  5.   


    CREATE OR REPLACE TRIGGER TRI_TEST
    AFTER INSERT OR UPDATE OR DELETE
    ON TABLE_TEST
    REFERENCING OLD AS OLD NEW AS NEW
    FOR EACH ROW
    BEGIN
     if inserting then ... end if;
     if updating then ... end if;
     if deleting then ... end if;
    END;