Page 1 of 1

Oracle EF too accurate ;)

Posted: Fri 12 Jun 2009 11:04
by markaw
Hi,

I have a small problem with EF and Oracle. I have a field that is defined NUMBER(9,6).

I'm updating this field with
update table
set field = 7.2290079999999994

Select on this field gives me 7,229008. Same result with plain old ADO.NET.

But if I get this field with EF I get... 7.2290079999999994.

Why?

PS. Guess what happens if you use optimistic concurrency?
update table
set something
where field = 7.2290079999999994

Best regards!

Posted: Mon 15 Jun 2009 15:40
by AndreyR
Oracle server converts double precision value to 7.2290079999999994, no matter what value it was set between
7.2290079000000000 to 7.2290079999999999.
The problem is associated with Double comparison.
More details are available here:
http://msdn.microsoft.com/en-us/library/ya2zha7s.aspx
So far there is no workaround for this problem. I will let you know if any solution is available.

Are you sure thats the problem

Posted: Tue 16 Jun 2009 12:59
by markaw
Hi,

I'm afraid I don't quite understand.

Oracle converts the values from between 7.2290079000000000 and 7.2290079999999999 to 7.2290079999999994 disregarding the NUMBER(9,6) definition. Good for you Oracle! :/

But leaving Oracle aside. How do you manage to read this value from database. I'm reading this value in SQLPlus i get 7.229008. If I use pure ADO.NET I get 7.229008. And in EF I get 7.2290079999999994. Good for you devart! :/

That afterwards by concurrency check comparison between 7.2290079999999994 and 7.229008 gives false is perfectly right. But that is not a problem. How do I get out from this situation (and I don't to turn off the concurrency check for this column!)?

Best regards!

Posted: Wed 17 Jun 2009 14:53
by AndreyR
We are investigating the problem, I will let you know about the results of our investigation.

Posted: Thu 25 Jun 2009 06:47
by markaw
How are we doing here?

Posted: Thu 25 Jun 2009 10:26
by AndreyR
We are working on it, no updates are available yet.

Posted: Mon 06 Jul 2009 13:36
by Shalex
As a workaround, please use the Double type property instead of Decimal. There will be a solution for this problem in the nearest builds of dotConnect for Oracle.

Posted: Mon 31 Aug 2009 13:15
by markaw
Is this issue fixed?

Posted: Mon 21 Sep 2009 13:53
by AndreyR
I recommend you to use the OracleConnection.NumberMappings property.
Try to set the Value type to Decimal in this case.
This property is available in the latest 5.25.42 build of dotConnect for Oracle.