2014-07-18 89 views
0

您好我已經創建了一個觸發器,你可以看到波紋管的下方,但它給了以下錯誤:ORA-04098:觸發器「triggername」是無效的,失敗再驗證

ORA-04098: trigger 'APPS.EMP_delete' is invalid and failed re-validation 

我的代碼:

CREATE OR REPLACE TRIGGER emp_delete 
AFTER DELETE 
    ON EMP 
    FOR EACH ROW 

BEGIN 

INSERT INTO history_emp (EMPLOYEE_ID, SALARY, JOB_ID, HIRE_DATE, DEPARTMENT_ID, FIRST_NAME,  last_name, DELETED_BY, DELETION_DATE) 
    VALUES 
    (:OLD.EMPLOYEE_ID, 
    :OLD.SALARY, 
    :OLD.JOB_ID, 
    :OLD.HIRE_DATE, 
    :OLD.DEPARTMENT_ID, 
    :OLD.FIRST_NAME, 
    :OLD.LAST_NAME, 
     USER, 
    SYSDATE); 

    DELETE FROM BACKUP_EMP WHERE EMPLOYEE_ID = :OLD.EMPLOYEE_ID; 

END; 

如何修復此錯誤?

+2

創建觸發器時會出現什麼錯誤?或者當你查詢'user_errors'? –

+0

執行以下操作並將結果粘貼到問題B編輯中。 'SELECT * FROM \t user_errors WHERE type ='TRIGGER'AND name ='EMP_DELETE';' – user75ponic

回答

0

這意味着你在'APPS.EMP_delete'觸發器中有一些錯誤,並且它不能被自動重新評估。你需要檢查你的觸發器體是否沒有錯。 例如:history_emp中所有列的名稱是否正確?