Oracle EF too accurate ;)

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
markaw
Posts: 13
Joined: Mon 11 Aug 2008 12:45

Oracle EF too accurate ;)

Post by markaw » Fri 12 Jun 2009 11:04

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!

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 15 Jun 2009 15:40

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.

markaw
Posts: 13
Joined: Mon 11 Aug 2008 12:45

Are you sure thats the problem

Post by markaw » Tue 16 Jun 2009 12:59

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!

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 17 Jun 2009 14:53

We are investigating the problem, I will let you know about the results of our investigation.

markaw
Posts: 13
Joined: Mon 11 Aug 2008 12:45

Post by markaw » Thu 25 Jun 2009 06:47

How are we doing here?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 25 Jun 2009 10:26

We are working on it, no updates are available yet.

Shalex
Devart Team
Posts: 8036
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 06 Jul 2009 13:36

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.

markaw
Posts: 13
Joined: Mon 11 Aug 2008 12:45

Post by markaw » Mon 31 Aug 2009 13:15

Is this issue fixed?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 21 Sep 2009 13:53

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.

Post Reply