0
是否可以在一個觸發器中有多個表?假設我有員工,技能和客戶表,並且我有Eventlogs表來捕獲審計。我試圖添加Skill_T,但是我得到了ORA-04079錯誤。任何更正?謝謝!錯誤ORA-04079:無效的觸發器規格
注:我使用的Oracle SQL Developer Oracle11gEE
CREATE OR REPLACE TRIGGER AUDIT_REC
AFTER INSERT OR DELETE OR UPDATE ON EMPLOYEE_T, SKILL_T
FOR EACH ROW
DECLARE
V_LOGID NUMBER;
V_USER VARCHAR(30);
V_DATE VARCHAR(30);
BEGIN
SELECT EVENTLOG_ID_SEQ.NEXTVAL, USER, SYSDATE INTO V_LOGID, V_USER, V_DATE FROM DUAL;
IF INSERTING THEN
INSERT INTO EVENTLOGS(Eventlog_id, User_name, Date_done, Action_done)
VALUES (V_LOGID, V_USER, V_DATE, 'INSERT');
ELSIF DELETING THEN
INSERT INTO EVENTLOGS(Eventlog_id, User_name, Date_done, Action_done)
VALUES (V_LOGID, V_USER, V_DATE, 'DELETE');
ELSIF UPDATING THEN
INSERT INTO EVENTLOGS(Eventlog_id, User_name, Date_done, Action_done)
VALUES (V_LOGID, V_USER, V_DATE, 'UPDATE');
END IF;
END;
/
謝謝Hemant。現在我將爲每個表創建一個觸發器。 – Raymond