What is the difference between GetOracleDecimal and GetDecimal ?

  • Thread starter Thread starter Wolfgang Meister
  • Start date Start date
W

Wolfgang Meister

In order to retrieve a NUMBER value out of a column from an Oracle Table iinto a local variable
there are two functions:

Decimal var = reader.GetDecimal(1);

or

Decimal var = reader.GetOracleDecimal(1);

What are the differences ?

I am using the standard (non optimized) Oracle.DatAccess.Client resp. Oracle.DatAccess.Types
 
Hello Wolfgang,

I suppose they make some special formatting of the extacted data.
I recommed to compare this methods in Reflector tool to find out differences

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

WM> In order to retrieve a NUMBER value out of a column from an Oracle
WM> Table iinto a local variable there are two functions:
WM>
WM> Decimal var = reader.GetDecimal(1);
WM>
WM> or
WM>
WM> Decimal var = reader.GetOracleDecimal(1);
WM>
WM> What are the differences ?
WM>
WM> I am using the standard (non optimized) Oracle.DatAccess.Client
WM> resp. Oracle.DatAccess.Types
WM>
 
Wolfgang said:
In order to retrieve a NUMBER value out of a column from an Oracle Table iinto a local variable
there are two functions:

Decimal var = reader.GetDecimal(1);

or

Decimal var = reader.GetOracleDecimal(1);

What are the differences ?

I am using the standard (non optimized) Oracle.DatAccess.Client resp. Oracle.DatAccess.Types

A quick Google indicates:

The first return a System.Decimal - the second return a
Oracle.DataAccess.Types.OracleDecimal !

The difference is that first has 28 digits and the last 38 digits.

You can convert from the last to the first via the Value property.

Arne
 
Wolfgang said:
In order to retrieve a NUMBER value out of a column from an Oracle
Table iinto a local variable there are two functions:

Decimal var = reader.GetDecimal(1);

or

Decimal var = reader.GetOracleDecimal(1);

What are the differences ?

I am using the standard (non optimized) Oracle.DatAccess.Client resp.
Oracle.DatAccess.Types

The difference is that the first will crash with an overflow exception
if the value has a scale larger than what a .NET decimal can handle and
the oracledecimal will not and instead return you an OracleDecimal type.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top