我有以下触发器
CREATE OR REPLACE TRIGGER TRG_RESUME_AFTER_UPDATE
BEFORE INSERT OR UPDATE ON RESUME
FOR EACH ROW
BEGIN
:new.modified_date := SYSTIMESTAMP;
END;
哪个编译
TRIGGER TRG_RESUME_AFTER_UPDATE compiled
但是当我尝试插入时,我收到以下错误:
Error at Command Line : 11 Column : 8
Error report -
SQL Error: ORA-04098: trigger 'D.TRG_RESUME_AFTER_UPDATE' is invalid and failed re-validation
04098. 00000 - "trigger '%s.%s' is invalid and failed re-validation"
*Cause: A trigger was attempted to be retrieved for execution and was
found to be invalid. This also means that compilation/authorization
failed for the trigger.
*Action: Options are to resolve the compilation/authorization errors,
disable the trigger, or drop the trigger.
答案 0 :(得分:3)
PL / SQL对象可以"编译"但仍然有错误。这听起来像您使用的任何客户端程序可能无法给您正确的反馈。 (在SQLPlus中,它应该说"使用编译错误创建触发器"。)
在任何情况下,要做的事情是查询USER_ERRORS以找出错误是什么。由于触发器非常简单,我猜测表中modified_date
不存在,或者它是时间戳无法隐式转换为的数据类型。如果是DATE
,则使用SYSDATE
比SYSTIMESTAMP
更合适。