通过oracle pl / sql

时间:2019-04-12 10:07:30

标签: oracle plsql

我需要从可以记录和监视的pl / sql脚本中发送错误。

我尝试创建一个只执行失败但不执行任何操作的过程,并显示自定义的错误消息。

PROCEDURE Custom_Error ()      
BEGIN
  raise_application_error(-20101, 'Custom Error!');
END Custom_Error;

我不允许。我收到此错误:

Compilation errors for PACKAGE ...
Error: PLS-00103: Encountered the symbol ")" when expecting one of the following:

我的计划是在后台调用此过程,然后在错误的后台作业日志中获取错误“自定义错误”。

这是解决这个问题的正确方法吗?

BR

1 个答案:

答案 0 :(得分:2)

PL / SQL中无参数过程的正确语法

create or replace PROCEDURE Custom_Error is      
BEGIN
  raise_application_error(-20101, 'Custom Error!');
END Custom_Error;