Comparing Access Number Double field vs. Oracle VARCHAR field

TerryHogarth21

Board Regular
Joined
Mar 20, 2012
Messages
245
Hi Folks

Has anyone ever had experience with trying to compare a linked table that is in Access (connecting to an ORACLE database) to a local table in Access?

I have an access table - let's call it table1 and an ORACLE table called table2.

There is two fields in each table, Field1 and Field2.

Field1 are number and Field2 is a number both double field size.

The ORACLE table Field1 is number data type and Field2 is VARCHAR data type.

When I join Field1 to Field1 from both tables, it works and I get the results I'm looking for.

However, I notice that in the SQL string if I add a where clause similar to the below that calculations seem off.

Code:
 WHERE (table1.Field2 - table2.Field2) <> 0;
I'm noticing some odd behaviors since the field types are different.

Even when I import the table locally into Access from Oracle, I still get these odd variances of the precision such as .0000000000000001235

ORACLE's tables can't be adjusted - though I am wondering is there anything I can do in Access to alleviate the issue?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
> "Field1 are number and Field2 is a number both double field size ... When I join Field1 to Field1 from both tables, it works and I get the results I'm looking for."

Double-precision is good for big numbers BUT IS NOT AN ACCURATE DATA TYPE FOR EXACT COMPARISONS. For joining reliably, you cannot use single or double precision numbers. Can your values be converted to Long Integer data type?
 
Upvote 0
> "Field1 are number and Field2 is a number both double field size ... When I join Field1 to Field1 from both tables, it works and I get the results I'm looking for."

Double-precision is good for big numbers BUT IS NOT AN ACCURATE DATA TYPE FOR EXACT COMPARISONS. For joining reliably, you cannot use single or double precision numbers. Can your values be converted to Long Integer data type?

I did a quick test and changed the values to Long Integer data type, closed and reopened but still no luck in getting what I was hoping for.
I've done the same thing before in SQL Server with Access (both Microsoft products) and it works fine due to the data types being the same to run SQL logic via mathematical calculations but talking to other developers here, they always find odd data working with VARCHAR in Oracle when trying to compare with a Microsoft Application.

The precision isn't exact but from this standpoint it may need to just be truncated before comparing since we cannot change the ORACLE tables.
 
Upvote 0
the other thing to keep in mind is that data types need to be the same for linking -- and SIZE should be the same as well. You can, however, use criteria to join information. In those cases, however, you lose the ability to do Left and Right joins.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,252
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top