create or replace trigger tr_personalarchives
after update or delete on T_ARCHIVES old as old_value new as new_value 
for each row 
declare;
pragma autonomous_transaction;
begin
if updating then
update T_PERSONALARCHIVES
set archivesname=(select archivesname from t_archives where archivesid=:new_value.archivesid)
where archivesid=:new_value.archivesid;
end if;
commit;
end;大家能否帮忙看看,更新表T_archives时,更新表t_personalArchives的

解决方案 »

  1.   

    编译不通过,报ORA-04079:无效的触发器说明的错误,大家帮忙
      

  2.   

    里面有很多语法错误,因为有没有结构,所以就修改一下,没有编译:
    请参考:CREATE OR REPLACE TRIGGER tr_personalarchives
    AFTER UPDATE OR DELETE ON T_ARCHIVES
    FOR EACH ROW 
    DECLARE
        PRAGMA autonomous_transaction;
        vArchiveName T_ARCHIVES.archivesname%TYPE;
    BEGIN
    IF updating THEN
        SELECT archivesname FROM t_archives WHERE archivesid = :new.archivesid;
        UPDATE T_PERSONALARCHIVES set archivesname = vArchiveName;
        where archivesid = :new.archivesid;
    END IF;
    END;