diteps06
asked on
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.
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.
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.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
diteps06,
Can you post a describe of the two tables?
Can you post a describe of the two tables?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THANKS THE SOLUTIONS WERE VERY SEFUL