Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> outer join syntax...
Hi!
I'm comparing two tables in order to find out whether the column names differ.
But, somehow I can't get oracle to join all_tab_columns the proper way.
I'm using 9.2.0.4 on Linux.
Here's the testcase:
col TABLE_NAME format a15;
col COLUMN_NAME format a15;
drop table table1;
create table table1 (column1 number, column2 varchar(32), column3 number);
drop table table2;
create table table2 (column1 number, column3 number);
--Where is the result row with column2?
select
t1.table_name,t1.column_name, t2.table_name,t2.column_name
from
all_tab_columns t1 FULL JOIN all_tab_columns t2 on (t1.column_name = t2.column_name)
where t1.owner = 'SPIELPLATZ'
and t2.owner = 'SPIELPLATZ' and t1.table_name = 'TABLE1' and t2.table_name = 'TABLE2'
--Why does t2 not have a column_name column?
select
t1.table_name,t1.column_name, t2.table_name,t2.column_name
from
all_tab_columns t1 FULL JOIN all_tab_columns t2 using (column_name)
where t1.owner = 'SPIELPLATZ'
and t2.owner = 'SPIELPLATZ' and t1.table_name = 'TABLE1' and t2.table_name = 'TABLE2'
exit;
Also, as you can see when executing the script, the second select fails because t2 doesn't seem to have a column column_name. Why?
Lots of Greetings and thanks!
Volker
Received on Tue Apr 20 2004 - 10:09:06 CDT