Is it possible through SQL in oracle to compare two tables and list the columns that exist in one but not the other. I have two tables, one (table A) that receives the data from an authoritative source with a specific code and the second is the rest of the data from that import without that specific code (Table B). I was hoping there would be a fast way in SQL to compare the two tables and tell me what columns exist specifically in Table A and not in Table B? Thanks.
+3
A:
Use:
SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='A' AND OWNER='YourSchema'
minus
SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE TABLE_NAME='B' AND OWNER='YourSchema'
PerlDev
2009-11-04 20:24:57
Thanks! That worked like a charm.
mcauthorn
2009-11-04 20:28:30