Oracle.Dataaccess错误ORA-06502:PL / SQL:数字或值错误:字符串缓冲区太小错误、缓冲区、太小、字符串

由网友(比情兽更禽兽 Ani)分享简介:我从调用.NET应用程序中的存储过程。我们把proc返回VARCHAR2类型的输出参数。为了FETCH这out参数我传递的参数的命令的OracleParameter:parm12 =新的OracleParameter(密押,OracleDbType.Varchar2,OUT2,ParameterDirection.O...

我从调用.NET应用程序中的存储过程。我们把proc返回VARCHAR2类型的输出参数。为了FET CH这out参数我传递的参数的命令的OracleParameter:

  parm12 =新的OracleParameter(密押
                              ,OracleDbType.Varchar2
                              ,OUT2
                              ,ParameterDirection.Output);
 

当我执行PROC我收到一个错误

  PL / SQL:数字或值错误:字符串缓冲区太小。
 

解决方案

找到了答案。

修改oracle数据文件大小 报错 ORA 03297

有关OUT参数我声明的大小最大为varchar - 32767,并开始工作。

要简化,该存储过程返回类型为VARCHAR2的参数OUT。但要使用来自.NET我经过VARCHAR2无任何大小的输出。所以分配到接受她的reurn值的缓冲空间为0字节。当PROC返回值比分配的缓冲区是0字节是错误的更多信息。

所以,我指定VARCHAR2-32767在C#code中的最大值,并开始工作。)

I am invoking a stored proc from .NET app. The proc returns an out parameter of type Varchar2. To fet ch the out parameter I am passing the parameter to the command as OracleParameter:

parm12 = new OracleParameter("testkey"
                              , OracleDbType.Varchar2
                              , out2
                              , ParameterDirection.Output);

When I execute the proc I am receiving an error

PL/SQL: numeric or value error: character string buffer too small.

解决方案

Found the answer.

For the OUT parameter i declared the size to max of varchar - 32767 and it started to work.

To simplify, the stored proc returns a parameter OUT of type VARCHAR2. But to consume that output from .NET i was passing VARCHAR2 without any size. So the buffer space allocated to recieve the reurn value was 0 bytes. When the proc returns the value more than allocated buffer which is 0 bytes it errors out.

So i specified the max of VARCHAR2-32767 in the C# code and it started to work :).

阅读全文

相关推荐

最新文章