ORA-04079:无效的触发器规范---错误的occered

时间:2016-11-23 15:48:41

标签: oracle plsql

我的触发器是:

CREATE OR REPLACE trigger TA_C_WARRANTY_AUDIT_TRG
BEFORE INSERT OR DELETE OR UPDATE ON TA_WARRANTY
FOR EACH ROW`enter code here`
ENABLE
DECLARE
  v_user VARCHAR2(30);
  v_date VARCHAR2(30);
BEGIN
SELECT user, TO_CHAR(sysdate,'DD/MON/YYYY HH24:MI:SS') INTO v_user,v_date FROM dual;
IF INSERTING THEN
  INSERT INTO TA_C_WARRANTY_AUDIT(new_name,old_name,user_name,entry_date,operation)
  VALUES (:NEW.LAST_UPDATE_ID, NULL,v_user,v_date,'Insert');
ELSIF DELETING THEN  
  INSERT INTO TA_C_WARRANTY_AUDIT(new_name,old_name,user_name,entry_date,operation)
  VALUES (NULL, :OLD.LAST_UPDATE_ID,v_user,v_date,'Delete');
ELSIF UPDATING THEN  
  INSERT INTO TA_C_WARRANTY_AUDIT(new_name,old_name,user_name,entry_date,operation)
  VALUES (:NEW.LAST_UPDATE_ID, :OLD.LAST_UPDATE_ID,v_user,v_date,'Update');
END IF;
END;
/

看起来我的代码没问题,但我收到以下错误消息: ORA-04079:无效的触发器规范

任何建议或想法都将受到高度赞赏。

修改

CREATE TABLE TA_C_WARRANTY_AUDIT
(
    new_name                                VARCHAR2(30),
    OLD_name                                VARCHAR2(30),
    user_name                               VARCHAR2(30),
    entry_date                              VARCHAR2(30),
    operation                               VARCHAR2(30)
);

1 个答案:

答案 0 :(得分:-1)

尝试从代码中删除ENABLE