undefine owner
undefine type
set verify off
set linesize 200
set feedback off
set heading off
spool create_synonyms.sql
select 'drop public synonym '||object_name||';'
from dba_objects
where owner = '&&owner'
and object_type = '&&type'
union
select 'create public synonym '||object_name||' for '||user||'.'||object_name||';'
from dba_objects
where owner = '&&owner'
and object_type = '&&type'
order by 1 desc
/
spool off
set heading on
set feedback on
