【问题标题】:ORA-04088: error during execution of trigger - additional errorsORA-04088: 执行触发器期间出错 - 附加错误
【发布时间】:2018-03-21 09:15:37
【问题描述】:

我有一个空白表,我已经为其设置了触发器:

CREATE OR REPLACE TRIGGER   authors_bir
BEFORE INSERT ON authors
FOR EACH ROW

begin
  if upper(:new.name) = 'TEST' then
    raise_application_error(-20001, 'Sorry, that value is not allowed.');
  end if;
end;

执行后:

insert into AUTHORS
    VALUES (1, 'test', '1-Jan-1989', 'M');

为什么除了预期的 ORA-20001 错误提示之外,我还会收到 ORA-06512 和 ORA-04088 错误消息?

错误消息

Error starting at line : 5 in command -
insert into AUTHORS
    VALUES (1, 'test', '1-Jan-1989', 'M')
Error report -
ORA-20001: Sorry, that value is not allowed.
ORA-06512: at "RPS.AUTHORS_BIR", line 3
ORA-04088: error during execution of trigger 'RPS.AUTHORS_BIR'

【问题讨论】:

  • 向我们展示作者的架构。
  • @anonyXmous 希望这就是您要找的东西? pastebin.com/X6usMe7m

标签: sql oracle


【解决方案1】:

您的触发器完美运行,ORA-06512 是调试模式的一部分,它会告诉您哪一行代码引发了您编写的 ORA-20001。虽然 ORA-04088 表示触发器中发生了错误。这两个错误代码都是 oracle 故障排除报告的 GENERIC 部分。

【讨论】:

    【解决方案2】:

    根据documentation

    ORA-06512: 在 stringline 字符串处

    原因:堆栈被未处理的异常展开时的回溯消息。

    基本上,这个错误是错误堆栈的一部分,告诉实际错误发生在哪一行。

    还有documentation

    ORA-04088: 执行触发器'string.string'时出错

    原因:执行触发器期间发生运行时错误。

    这个错误是错误堆栈的一部分,告诉你错误实际上发生在触发器中。

    当发生未处理的错误时,总是显示错误堆栈。如果您只想显示错误消息,您可以使用异常处理部分,以便触发器的主体看起来像这样:

    begin
      if upper(:new.name) = 'TEST' then
        raise_application_error(-20001, 'Sorry, that value is not allowed.');
      end if;
    exception
      when others then
        dbms_output.put_line(sqlcode|' '|sqlerrm);
    end; 
    

    【讨论】:

      猜你喜欢
      • 2017-03-26
      • 2013-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-06
      • 2022-01-20
      相关资源
      最近更新 更多