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 or 29 precision. When the GetDecimal()
method is called for an Oracle NUMBER
value that cannot be represented as a .NET Decimal
, then 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.