Oracle.Dataaccess error ORA-06502: PL/SQL: numeric or value error: character string buffer too small

﹥>﹥吖頭↗ 提交于 2019-12-23 11:51:03

问题


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.

回答1:


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 :).




回答2:


In your code out2 is the argument which specifies the length of the parameter. So check the value in that variable, because apparently it is not long enough for procedure's output.



来源:https://stackoverflow.com/questions/2077552/oracle-dataaccess-error-ora-06502-pl-sql-numeric-or-value-error-character-str

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!