Oracle 触发器失败 -ORA-04098
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2334509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle trigger failed -ORA-04098
提问by Vijay
I have a table for which i have written a trigger:
我有一个表,我已经为它写了一个触发器:
CREATE OR REPLACE TRIGGER ac01_control_trigg
AFTER INSERT ON ac1_control_test
FOR EACH ROW
DECLARE
BEGIN
IF :NEW.cur_pgm_name = 'LSN'
AND :NEW.nxt_pgm_name ='MD'
AND :NEW.file_status='RD' THEN
INSERT INTO ac1_control_test
(FILE_NAME, FILE_PATH,FILE_STATUS,CUR_PGM_NAME,NXT_PGM_NAME)
VALUES
(:NEW.FILE_NAME, :NEW.FILE_PATH,:NEW.FILE_STATUS,:NEW.CUR_PGM_NAME,'MD_MPS');
END IF;
END ac01_control_trigg;
when i am trying to insert into the table i am getting an error below!
当我尝试插入表格时,出现以下错误!
ORA-04098: trigger 'CNGDB18.AC01_CONTROL_TRIGG' is invalid and failed re-validation
could anybody please help?
有人可以帮忙吗?
also when i compile the trigger in Toad,i am getting compile errors as below:
此外,当我在 Toad 中编译触发器时,出现如下编译错误:
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/65 PLS-00049: bad bind variable 'NEW_FILE_STATUS'
but what is the wrong with this? and what does this error mean?
但这有什么问题呢?这个错误是什么意思?
回答by Peter Lang
EDIT: Now that we see the message, the solution is easy :)
编辑:现在我们看到消息,解决方案很简单:)
Use :NEW.file_status='RD'
instead of:new_file_status='RD'
使用:NEW.file_status='RD'
代替:new_file_status='RD'
Your trigger object is invalid (there is a problem with the code).
您的触发器对象无效(代码有问题)。
Test this with:
测试这个:
SELECT object_name, status
FROM user_objects
WHERE object_name = 'AC1_CONTROL_TRIGG';
Should return:AC1_CONTROL_TRIGG INVALID
应该返回:AC1_CONTROL_TRIGG INVALID
You can try the following in SQL*Plus
to get a description of the error:
您可以尝试以下操作SQL*Plus
以获取错误描述:
ALTER TRIGGER ac1_control_trigg COMPILE;
SHOW ERROR TRIGGER ac1_control_trigg;
Using TOAD, you can just type these two lines into an editor, select them and use Editor
>Execute SQL via SQL*Plus
.
使用 TOAD,您只需在编辑器中输入这两行,选择它们并使用Editor
> Execute SQL via SQL*Plus
。