General SQL Question [message #373501] |
Thu, 19 April 2001 15:14 |
Sam
Messages: 255 Registered: April 2000
|
Senior Member |
|
|
I need to Validate Column Names(check to see if the columns are the same or spelt the same in both tables) in 2 Identical ORACLE tables. Can someone help me with that. I am trying to use ALL_TAB_COLUMNS data dictionary view.
Any help will be appreciated.
|
|
|
Re: General SQL Question [message #373502 is a reply to message #373501] |
Thu, 19 April 2001 15:44 |
Andrew again...
Messages: 270 Registered: July 2000
|
Senior Member |
|
|
the following table should return no rows...
(select table_name, column_name, data_type, data_length, data_precision, nullable
from all_tab_columns
where table_name = 'T1'
and owner = 'SCOTT'
MINUS
select table_name, column_name, data_type, data_length, data_precision, nullable
from all_tab_columns
where table_name = 'T2'
and owner = 'SCOTT')
UNION
(select table_name, column_name, data_type, data_length, data_precision, nullable
from all_tab_columns
where table_name = 'T2'
and owner = 'SCOTT'
MINUS
select table_name, column_name, data_type, data_length, data_precision, nullable
from all_tab_columns
where table_name = 'T1'
and owner = 'SCOTT');
|
|
|