"Arithmetic operation resulted in an overflow" Error running a report that uses a connection data source to Oracle 10

If you are using Reporting Services to create reports that connects to your Oracle 10 server, you might find yourself with the following error:

  "Arithmetic operation resulted in an overflow"

 

The StackTrace would be the following:

System.Data.Odbc.OdbcStatementHandle.RowCount(System.Data.Odbc.SQLLEN ByRef)
System.Data.Odbc.OdbcDataReader.GetRowCount()
System.Data.Odbc.OdbcDataReader.FirstResult()
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(System.Data.CommandBehavior,System.String, Boolean, System.Object[], SQL_API)
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(System.Data.CommandBehavior,System.String, Boolean)
System.Data.Odbc.OdbcCommand.ExecuteReader(System.Data.CommandBehavior)
System.Data.Odbc.OdbcCommand.ExecuteDbDataReader(System.Data.CommandBehavior)
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(System.Data.CommandBehavior)
Microsoft.ReportingServices.DataExtensions.CommandWrapper.ExecuteReader(Microsoft.ReportingServices.DataProcessing.CommandBehavior)
Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunDataSetQuery()

After struggling to find the cause of this we found that it was caused by a bug in the Oracle ODBC driver.  It affects the versions: 10.2.0.4 to 11.2.0.1 of Oracle and only the 64 bit driver (not the 32 bit driver).
This is why your 64 bit server might be affected but your 32 bit machine would not.

 

The corresponding bug in Oracle that causes this behavior is:

Bug 9793452 - EXECUTEREADER FAILS WITH OVERFLOW: SQLROWCOUNT RETURNS INCORRECT VALUE

 

You would need to install the following Oracle patches

For 10.2.0.4.0, apply Patch 10084982 or later.

For 10.2.0.5.0, apply Patch 10155844 or later.

For 11.2.0.1.0, apply Patch 9966926 or later.

Fixed also in 11.2.0.2.0 Patch 10098816

 

References

BUG:9793452 - EXECUTEREADER FAILS WITH OVERFLOW: SQLROWCOUNT RETURNS INCORRECT VALUE

More generic information about hte bug:

Retrieving data using a .NET ODBC application may fail with: 'Arithmetic operation resulted in an overflow'. This can occur with a call to ExecuteReader on the OdbcCommand object, the fill method of the OdbcDataAdaptor object and others.

 

 

Maria Esteban

Reporting Services Support Engineer