ORA-06502: PL/SQL: numeric or value error

Saturday, 5 May 2007 14:11 by RanjanBanerji

ORA-06502: PL/SQL: numeric or value error is something I have seen many a times but each time this error has surfaced after a long gap and of course each time I have forgotten what the most common cause is for a software developer.  The latest incident was today when making a call to a stored procedure on a Oracle 10g database.  The stored procedure had several out VARCHAR2 parameters in addition to various other out parameters.

After some head scratching minutes (more like an hour) I finally found the source of the error in this case.  We were using a level of abstraction, i.e., using IDataParameter rather than OracleParameter.  As a result of which while creating an out direction string parameter the size of the string was not set.  Ahaaaaa!  Oracle drivers do not like that.

So, check to see if your stored procedure has VARCHAR2 out parameters.  If so, check your .Net code to see if your IDataParameter implementation (in this case OracleParameter) for this procedure parameter has its size property set and that the value of the size property is greater than or equal to what you plan to return from the stored procedure.

Categories:   .Net
Actions:   E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed