2 Replies Latest reply: Jun 25, 2009 11:57 AM by 708867 RSS

    Decimal Number precision problem when filling a dataset Arithmetic overflow

    708867
      I've typed up this issue here but no resolution yet:
      [http://stackoverflow.com/questions/1043626/odp-net-oracle-decimal-number-precision-problem-when-filling-a-dataset-exception]

      I believe this has to do with the OracleDecimal being automatically converted to a System.Decimal which has a lower procession, this must happen automatically by the data adapter fill method.


      I'll type the question again here:

      I am working in c# .net 2 (Visual Studio 2005 SP1) attempting to fill a dataset with the results from a select * from table from an Oracle10g database. The .net framework, IDE and database cannot be changed at this client site.

      I'm connecting using the ODP.net provider the dll version is 2.102.2.20, have also now tried with 2.111.6.20 (11g)

      When I run the fill command I get an Exception:

      Arithmetic operation resulted in an overflow

      Also if I attempt to view the offending column in the Visual Studio designer (Show Table Data) I get *<Unable to read data>* for every row for this column in the table. The code works perfectly if my query selects other columns with integers for example omitting this column.

      The column in question looks fine when I view it in the database from Toad, data looks like:

      *919.742866695572*

      I need the precision as it's required for a monte carlo simulation.

      If instead of using a data adapter to fill the datatable I use a datareader and call dataReader.getValue(columnIndex) I get the same error but if I call dataReader.GetOracleDecimal(columnIndex) then I get the result I am looking for, no error.

      I would rather use data adapter and filling a dataset (note these are untyped datasets as I couldn't get autogenerated strongly typed datasets to work from an oracle db). I don't want to use datareader and walk through the results (pick out the column values) as I am trying to write this as a generic method to work for many scenarios regardless of number of columns, index of decimal columns that would require specific get calls by datatype.

      Can anyone help?

      Thanks

      Edited by: user11301111 on 25-Jun-2009 08:47