Arithmetic Operation Resulted In An Overflow

When I was executing the Stored Procs in Oracle from C# (using Oracle.DataAccess.dll – v or 11gR2 client as well), I’m receiving the below error.

“Arithmetic Operation Resulted In An Overflow.”

Couldn’t figure it out why it is happening all of sudden.Verified all the code and nothing has been changed but observed that the data in the Database has got updated.

Tried to figure it out why the data is introducing new errors and understood that the OracleClient is using Int32 as it’s parameter to convert the data from Cursor to DataTable.

Possible Solutions:

1. Data in the column coming more than Int32 value.
2. Length of the number Data in the column is more than 28 digits (excluding the decimal point), means 99999.999 is 8 digits.
3. Length of the decimal values are more than 16 digits. (eg., 123.12345678901234567)

FYI, stack trace:

at Oracle.DataAccess.Types.DecimalConv.GetDecimal(IntPtr numCtx)
at Oracle.DataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
at Oracle.DataAccess.Client.OracleDataReader.GetValues(Object[] values)
at System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)
at System.Data.ProviderBase.SchemaMapping.LoadDataRow()
at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.LoadAdapter.FillFromReader(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
at System.Data.DataTable.Load(IDataReader reader)
at DataHelper.RetrieveOutputCursor(OracleCommand cmd, Hashtable htResults) in C:\DataHelper.cs:line 294
at DataHelper.ExecuteProcedureReturnDataSet(String procName, Hashtable spParams) in C:\DataHelper.cs:line 208

Check it out for this possibility as well. 🙂

– Gangadhar Kotu


One response to this post.

  1. Posted by Aparna J. N on June 26, 2012 at 10:13 am

    Thank you very much for this article. I was super glad to have found this when I needed it so badly.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: