SuppressGetDecimalInvalidCastException
This property specifies whether to suppress the InvalidCastException
and return a rounded-off 28 precision value if the Oracle NUMBER
value has more than 28 precision.
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 precision. When the GetDecimal()
method is called to retrieve numbers with more than 28 precision, ODP.NET throws an InvalidCastException
since 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.