我有一些用Oracle编写的程序.不幸的是我无法显示其代码.其中的某个地方是由于缺少必需的数据而选择执行崩溃的地方.看起来像这样
select value into l_value from config where code = upper(p_code);
所以当我这样调用这个过程时(在SqlDeveloper中)
execute some_package.some_procedure('CODE');
它抛出
Error report - ORA-01403: no data found ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 111 ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 111 ORA-06512: at line 1 01403. 00000 - "no data found" *Cause: No data was found from the objects. *Action: There was no data from the objects which may be due to end of fetch.
但是当我这样称呼它时
call some_package.some_procedure('CODE');
它崩溃在同一个地方(我可以从结果中建议,存储在DB中),但它没有抛出异常.
some_package.some_procedure('CODE') succeeded.
怎么了?为什么会有这样的差异?
NO_DATA_FOUND
异常行为很特殊.它在SQL上下文中默认处理,但在PL/SQL中不处理.在SQL中,没有发现的数据不被视为错误,它一直发生在没有满足特定条件的数据的情况下.
CALL
是SQL命令,而是PL/SQL EXEC
的快捷方式BEGIN
END;
.