Detect columns in Oracle table are equal comparing data

I would like to detailed compare two tables t1 and t2.
Table t1 have 73 columns whereas t2 have 101.
I would like to have a query which returns columns common to both.
There also columns that have been renamed that at times is difficlut to know they are equivalent.
For example CD_AB may have been rename CD_BD but they are suppose to be the same.
The contents of the columns can confirmed it.
Both tables have 3 columns that make up the primary. Two of the columns are common.
How can I make a query to know some columns are common from their contents.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

awking00Information Technology SpecialistCommented:
Comparing the data is not difficult, but not knowing which column names to apply is another story. I would start with comparing the columns that you know to be the same (i.e. they have the same name and datatypes). As for the remaining columns, do you expect the values, from your example, of CD_AB in t1 to be the same as the values of CD_BD in t2? If so, you might be able to select the column names from t1 that are not in t2 and dynamically compare them to the columns in t2 that are not in t1 and look for matching data. I'll work on the procedure to manage the first case and, depending on your response to the question, continue with a possible means of determining the second case.
slightwv (䄆 Netminder) Commented:
I agree with everything said above.  There is really no way to 'map' columns based on the data contained in them without some possibility of error.

>>columns in Oracle table are equal
>>I'll work on the procedure to manage the first case

Why write code?  Once the columns are mapped, wouldn't a simple INTERSECT query return matching rows?
awking00Information Technology SpecialistCommented:
slightwv, I agree with what you are saying as well, the key being once the columns are mapped. Then a simple intersect would return matching rows or a simple minus would return non-matching rows. The attached procedure will ascertain that for columns that are known to map.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

awking00Information Technology SpecialistCommented:
Can you post a describe of the two tables?
awking00Information Technology SpecialistCommented:
The attached procedure will find columns whose names are different, but whose datatypes are the same and the data in each table is the same. The problem with this is that, if they don't match, you won't know whether it's due to the data or it's a different column altogether.
diteps06Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.