SuppressGetDecimalInvalidCastException
This property specifies whether to suppress the InvalidCastException
and return a rounded-off 28 or 29 precision Oracle NUMBER
value that can be represented as a .NET decimal.
Declaration
// C# public bool SuppressGetDecimalInvalidCastException { get; set; }
Property Type
System.Boolean
Remarks
Oracle NUMBER
has a maximum of 38 precision. .NET Decimal has a maximum of 28 or 29 precision. When the GetDecimal()
method is called to retrieve numbers with more than 28 or 29 precision, ODP.NET throws an InvalidCastException
because not all the precision can be preserved when converting the number to a .NET Decimal
.
This behavior occurs when SuppressGetDecimalInvalidCastException
is set to false
. Its default value is false
.
When SuppressGetDecimalInvalidCastException
is set to true
, then the resulting decimal will be rounded off to 28 or 29 precision so that it can fit as a .NET decimal without throwing an exception.