Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 611
moejoe11 Avatar asked Jan 16 '10 14:01

moejoe11


1 Answers

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

like image 163
moejoe11 Avatar answered Sep 22 '22 12:09

moejoe11