Well - it's just a case statement isnt it ?
SQL> drop table a purge;
Table dropped.
SQL> drop table b purge;
Table dropped.
SQL>
SQL> create table A as select * from dba_objects where 1=0;
Table created.
SQL>
SQL> create table B as select * from dba_objects where 1=0;
Table created.
SQL>
SQL> alter table B drop column object_id;
Table altered.
SQL>
SQL> alter table B add new_col int;
Table altered.
SQL>
SQL> alter table B modify owner varchar2(250);
Table altered.
SQL>
SQL> with col_check as
2 (
3 select *
4 from (
5 select column_name a_col,data_type a_dt,data_length a_len
6 from user_tab_columns
7 where table_name = 'A'
8 ) a
9 full outer join
10 ( select column_name b_col,data_type b_dt,data_length b_len
11 from user_tab_columns
12 where table_name = 'B'
13 ) b
14 on a.a_col = b.b_col
15 )
16 select a_col, b_col,
17 case
18 when a_col is null then 'alter table a add '||b_col||' '||b_dt||'('||b_len||')'';'
19 when b_col is null then 'alter table b add '||a_col||' '||a_dt||'('||a_len||')'';'
20 else 'alter table b modify '||b_col||' '||b_dt||'('||a_len||')'';'
21 end ddl
22 from col_check
23 where a_col is null
24 or b_col is null
25 or a_dt != b_dt
26 or a_len != b_len;
A_COL B_COL DDL
------------------------------ ------------------------------ --------------------------------------------------
OWNER OWNER alter table b modify OWNER VARCHAR2(128)';
NEW_COL alter table a add NEW_COL NUMBER(22)';
OBJECT_ID alter table b add OBJECT_ID NUMBER(22)';
3 rows selected.
SQL>
You would need to decide who is the "winner" (ie, which table is "correct" when differences occur)