限制 Oracle 创建编译错误过程



我想知道是否有办法让 Oracle 在出现任何类型的错误不创建过程/函数

在 CREATE 之后的 SQL 脚本中,您可以检查ALL_ERRORS(或dba_errors(该对象是否存在错误,如果存在错误,则立即执行以删除它。

例如(

set serveroutput on
create or replace procedure meowner.testproc
as
begin
  select;
end;
/
DECLARE
  x number;
begin  
   select count(*) into x from all_errors
   where  owner = 'MEOWNER' and NAME='TESTPROC' ;
   if x != 0 then
      EXECUTE IMMEDIATE 'DROP PROCEDURE meowner.testproc';
      dbms_output.put_line('Dropped due to compile error');
   end if;
end;
/
PROCEDURE TESTPROC compiled
Errors: check compiler log
Dropped due to compile error
anonymous block completed

我所知,没有。将创建处于无效状态的存储过程。

但是,您可以尝试创建一个包装器过程,这将

  • 创建过程
  • 检查其状态
  • 如果无效,请将其删除

最新更新