oracle – 我可以在函数编译失败时使SQL * Plus退出并出现错误吗
发布时间:2021-01-20 13:16:07 所属栏目:站长百科 来源:网络整理
导读:我一向致力于通过SQL * Plus以自动方法陈设的Oracle成果.偶然我犯了一个错误,Oracle说: Warning: Function created with compilation errors. 然后我可以行使SHOW ERR来查察错误,但我想知道是否有一些我可以配置的设置,在这样的编译错误上: 将不会建设该功
我一向致力于通过SQL * Plus以自动方法陈设的Oracle成果.偶然我犯了一个错误,Oracle说:
然后我可以行使SHOW ERR来查察错误,但我想知道是否有一些我可以配置的设置,在这样的编译错误上: >将不会建设该成果 像 办理要领这有点令人费解,但你可以.初始CREATE FUNCTION或CREATE PROCEDURE语句将建设函数或进程.您必需在剧本中检测到存在错误,并在呈现错误时显式删除函数和/或进程.可是你必需在删除工具之前捕捉错误.这将必要在CREATE语句之后的剧本中的一些代码. whenever sqlerror exit failure; create or replace procedure compile_error as begin select count(*) into no_such_variable from emp; end; / show error; declare l_num_errors integer; begin select count(*) into l_num_errors from user_errors where name = 'COMPILE_ERROR'; if( l_num_errors > 0 ) then execute immediate 'DROP PROCEDURE compile_error'; raise_application_error( -20001,'Errors in COMPILE_ERROR' ); end if; end; / 执行时,此剧本将天生以下输出,个中包括错误并将删除该进程. SQL> @c:tempcompile_errors.sql Warning: Procedure created with compilation errors. Errors for PROCEDURE COMPILE_ERROR: LINE/COL ERROR -------- ----------------------------------------------------------------- 4/3 PL/SQL: SQL Statement ignored 5/10 PLS-00201: identifier 'NO_SUCH_VARIABLE' must be declared 6/5 PL/SQL: ORA-00904: : invalid identifier declare * ERROR at line 1: ORA-20001: Errors in COMPILE_ERROR ORA-06512: at line 12 Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning,OLAP,Data Mining and Real Application Testing options (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |