0
我創建觸發器來更新其他表進行審計。 我正在審計的主表是「僱用」,審計表是「salary_history」。每一次更新都是在Emplyed表中進行的,薪水錶必須更新。 我這個觸發器在Oracle 11g中的工作:problema在oracle中創建觸發器來更新其他表
CREATE OR REPLACE TRIGGER salary_auditing
AFTER UPDATE ON employed
REFERENCING NEW AS NEW OLD AS OLD
BEGIN
INSERT INTO SALARY_HISTORY(ID, EMPLOYED_ID, OLD_SALARY, NEW_SALARY, DATE_MODIFIED) VALUES (SELECT MAX(ID)+1 FROM SALARY_HISTORY, ID, :OLD.salary, :NEW.salary, SYSDATE)
END salary_auditing
的problema是,當我運行此觸發我收到此錯誤:
Relatório de erros -
ORA-04082: referências NEW ou OLD não permitidas nos gatilhos de nível de tabela
04082. 00000 - "NEW or OLD references not allowed in table level triggers"
*Cause: The trigger is accessing "new" or "old" values in a table trigger.
*Action: Remove any new or old references.
英語就意味着新的或舊值是不允許在表nivel。
我應該做些什麼修改?