I have two tables inside two different database with granted access to two users. I put two tables and also my query to get the result like below but I am getting error. Please help. Thanks
I want to see the result like this:
Alter table Target_table modify BOOK_ID Varchar2 (4);
Alter table Target_table add ISBN_10 Varchar2(13), null;
Alter table Target_table drop TITLE;
Tables and quesries:
GRADE_CONVERSION table in sarigul@database
LETTER_GRADE | GRADE_POINT | MAX_GRADE | MIN_GRADE |
ds | .24 | 45 | 6 |
as | .25 | 45 | 4 |
fr | .26 | 4 | 1 |
hy | .27 | 45 | 9 |
kl | .23 | 45 | 6 |
GRADE_CONVERSION table in erhan@database
GRADE_POINT | GRADE_POINT | MAX_GRADE | MIN_GRADE | CREATED_BY | CREATED_DATE | CREATED_BY | MODIFIED_DATE |
GR | .12 | 2 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
GR | .1 | 2 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
TR | .12 | 2 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
SR | .12 | 2 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
YR | .13 | 72 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
GR | .13 | 28 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
JR | .13 | 2 | 935 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
KR | .12 | 42 | 355 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
LR | .14 | 2 | 356 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
MR | .19 | 2 | 3 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
QR | .15 | 2 | 35 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
AR | .17 | 2 | 15 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
BR | .13 | 2 | 75 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
CR | .12 | 2 | 65 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
XR | .14 | 2 | 55 | YES | 12/09/2013 00:00:00 | ERHAN | 03/09/2012 00:00:00 |
select case when column_name_s is null and column_name_t is not null
then 'alter table target_table drop ' || column_name_t || ';'
when column_name_s is not null and column_name_t is null
then 'alter table target_table add ' || column_name_s || ' ' || data_type_s || ';'
else 'alter table target_table modify ' || column_name_t || ' ' || data_type_s || ';'
end alterations
from (select s.coulmn_name column_name_s,t.coulmn_name column_name_t,
s.data_type data_type_s,t.data_type data_type_t
from (select column_id,column_name,data_type
from all_tab_cols@database
where owner = 'erhan'
and table_name = 'GRADE_CONVERSION'
) s
full outer join
(select column_id,column_name,data_type
from all_tab_cols@database
where owner = 'sarigul'
and table_name = 'GRADE_CONVERSION'
) s
on s.LETTER_GRADE = t.LETTER_GRADE
)
result: ORA-00904: "T"."LETTER_GRADE": invalid identifier