与执行直接和错误处理做约两个小时的价值的研究上的各种问题之后,我不认为我遇到的正是我要提出的问题。我已将问题简化为下面的示例。问题是:甲骨文执行DDL立即模式和错误
当我执行一个程序创建即时模式在变量中创建文本和语法错误,在创建文本时,执行立即调用抛出,表明它失败的错误。但我无法了解潜在的错误或其文本。
然而,当我在sqlplus直接创建相同PROC(W/O中间模式)时,得到错误完美。
那么,如何在一个导致即时模式失败的错误得到什么?
我已经穿插的输出与我的评论(MOP),减少的空白行数:
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 25 15:57:06 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> set serveroutput on
SQL> declare
2 eSQL varchar(568);
3 begin
4 eSQL := 'create or replace procedure MOPMOP
5 as
6 begin
7 select 1 from dual;
8 end;
9 ';
10 execute immediate eSQL;
11 end;
12/
ERROR:
ORA-24344: success with compilation error
ORA-06512: at line 10
Warning: PL/SQL compilation errors.
这是一件好事。有一个编译错误。所以,现在让我问一下那个编译错误是什么:
SQL> show errors;
No errors.
这是不行的。有一个编译错误。它以前如何!?!?!?与此相反:
SQL> create or replace procedure MOPMOP
2 as
3 begin
4 select 1 from dual;
5 end;
6/
Warning: Procedure created with compilation errors.
这很好。有一个编译错误。所以,现在让我来问一下那个编译错误是什么:
SQL> show errors;
Errors for PROCEDURE MOPMOP:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/5 PLS-00428: an INTO clause is expected in this SELECT statement
SQL>
这很好。有一个编译错误。现在我知道这是什么。
那么,如何才能获得中间模式吐出底层(00428)错误?
我认为他的代码只是说明的需要,使我们能够重现问题。 – 2013-03-25 22:59:49
当然...我希望他学会了关于显示错误... – Art 2013-03-26 13:15:41
是的,这只是一个repro。 – mpersico 2013-03-26 16:48:34