Decimal overflow: bug of Oracle .NET Managed driver
See original GitHub issueThe Decimal
column from Oracle DB can produce an overflow of the corresponding .NET decimal
.
Eccezione non gestita: System.InvalidCastException: Cast specificato non valido.
in Oracle.ManagedDataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
in Oracle.ManagedDataAccess.Client.OracleDataReader.GetValue(Int32 i)
in Sql2Xlsx.Oracle.<Read>d__3.MoveNext() in C:\dev\SqlServer\Sql2Xlsx\Oracle.cs:riga 102
A workaround is needed.
// decimal overflow workaround
field.ObjValue =
field.DataType == "Decimal"?
DR.GetDouble(i) :
DR.GetValue(i);
Please forward and fix the code in the Oracle .NET Managed driver, thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Oracle managed driver ODP.NET with NHibernate 4.0 ...
So the problem of overflow can be resolved without making the field read only (using formula in NHibernate mappings). A custom user type...
Read more >ODP.NET - cannot read decimal values correctly
I have a problem with ODP.NET managed driver (version 12.1.24160419). I am trying to read a decimal value from a table. In table...
Read more >Oracle ODP.NET: Resolve “Arithmetic operation resulted in an ...
I ran into this issue as I was moving data from Oracle to SQL Server. ... NET: Resolve “Arithmetic operation resulted in an...
Read more >Oracle Decimal - Arithmetic operation resulted in an overflow.
Hi, I'm getting an exception from Oracle.DataAccess.Client.OracleDataReader I know, it's not related to XPO, but I'm using it to work with ...
Read more >Oracle Data Type Mappings - ADO.NET
Decimal or OracleNumber instead of a floating-point value. Using the .NET Framework data type can cause an overflow.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In the next DB release, ODP.NET will introduce a new SuppressGetDecimalInvalidCastException property that will allow suppressing this error and round off the result automatically.
If you wish to preserve the entire NUMBER value, you can do so today with Safe Type Mapping.
It should be a double, not a decimal, and it should not throw an exception… Indeed this is why I kept my workaround and not the proposed-above property