oracle - Comparing two tables for different columns PL SQL -
i new pl sql , have encountered problem. not hard solve , i'm going wrong. problem this: have 2 tables different amount of columns. need run check see different columns , add them 1 of tables. example:
table 1 has 1 column called name.
table 2 has 2 columns called name , id.
(name has same data type in both tables)
in case, need run script check table 1 , 2, see table 1 missing 'id' column , add table 1.
is possible?
so far have this:
select table_name, column_name user_tab_columns table_name = 'test_tbl' or table_name ='test_tbl1'
which returns columns both tables. have looked everywhere on internet no luck @ all. have tried intersect , join no luck.
if has or point me in right direction appreciate much!
to different columns
select table_name, column_name user_tab_columns table_name = 'table1' , column_name not in ( select column_name user_tab_columns table_name='table2') union select table_name, column_name user_tab_columns table_name = 'table2' , column_name not in ( select column_name user_tab_columns table_name='table1');
Comments
Post a Comment