我们有表'Employee'和他们相应的'Employee_Audit'表
当我们尝试添加新行时,“Employee_Audit”表包含“插入”和“更新”条目
我的触发器是:
create or replace
TRIGGER Employee_AUDIT_TRIGGER
BEFORE DELETE OR INSERT OR UPDATE
ON Employee FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO Employee _AUDIT (OPERATION, ID, VERSION, NAME, TYPE)
VALUES('INSERT',:NEW.ID,:NEW.VERSION,:NEW.NAME,:NEW.TYPE);
ELSIF DELETING THEN
INSERT INTO Employee _AUDIT (OPERATION, ID, VERSION, NAME, TYPE)
VALUES ('DELETE',:OLD.ID,:OLD.VERSION,:OLD.NAME,:OLD.TYPE);
ELSIF UPDATING THEN
INSERT INTO Employee _AUDIT (OPERATION, ID, VERSION, NAME, TYPE)
VALUES('UPDATE',:NEW.ID,:NEW.VERSION,:NEW.NAME,:NEW.TYPE);
END IF;
END Employee_AUDIT_TRIGGER;
任何人都知道原因,没有例外。