暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 异常在PL/SQL过程中处理,但当被消耗时。net应用程序异常仍然发生

ASKTOM 2019-05-22
449

问题描述

我的程序代码
create or replace procedure proc1(e_id number,ename varchar2,result out varchar2)
as
begin
insert into emp_name(emp_id,emp_name) values(e_id,ename);
result:='Row inserted';
exception when others then
result:='Exception Occurs';
end;

当我在db中执行上述过程时,它正在执行并返回结果,即使发生异常

但是当这个用在。当异常发生时的网络层,而不是去异常块
甲骨文抛出异常

05/22/2019 06:07:23-异常消息: ORA-06502: PL/SQL: 数字或值错误: 字符串缓冲区太小ORA-06512: 在 “CHUB.CHUB_AUTOCONTINUATION_PKG”,第155行ORA-06502: PL/SQL: 数字或值错误: 字符串缓冲区太小ORA-12899: 对于列 ************* (实际: 39,最大值: 32) ORA-06512: 在第1行,堆栈跟踪: 在OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32 & cursorId,布尔bthroarraybindreratedrors,SqlStatementType sqlStatementType,Int32 arrayBindCount,OracleException & exception forarraybindddml,boolemorowsindb,布尔bFirstIterationDone) oracleParameterCollection paramColl,CommandType,OracleConnectionImpl connectionImpl,Int32 longFetchSize,Int64 clientInitialLOBFS,OracleDependencyImpl,orclDependencyImpl,Int64[]& scnfromexection,OracleParameterCollection & bindByPositionParamColl,布尔 & bbindparametiment,OracleException & exception forarraybindddmlml,oracedmanagecanection,或aclealtransacetaltran

专家解答

可能是您的调用应用程序提供的结果变量太小吗?

例如

SQL> create table emp_name ( emp_id int, emp_name varchar2(50));

Table created.

SQL>
SQL> create or replace
  2  procedure proc1(e_id number,ename varchar2,result out varchar2)
  3  as
  4  b例如in
  5    insert into emp_name(emp_id,emp_name) values(e_id,ename);
  6    result:='Row inserted';
  7  exception when others then
  8       result:='Exception Occurs';
  9  end;
 10  /

Procedure created.

SQL>
SQL>
SQL> declare
  2    res varchar2(5);      <<==== wont be able to hold the result
  3  b例如in
  4    proc1(1,'connor',res);
  5  end;
  6  /
declare
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "MCDONAC.PROC1", line 7
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "MCDONAC.PROC1", line 5
ORA-06512: at line 4



文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论