Generate SYNONYMS SQL


Submitted by:Jhon Smith

Date added:14 May, 2012

Category:PL SQL

How to generate SYNONYMS SQL

Tags: synonyms sql

Code Snippet:

    SELECT 'CREATE or REPLACE SYNONYM ' || :target_schema || '.' || object_name || ' for ' || :src_schema || '.' || object_name || ';' FROM (
SELECT table_name AS object_name FROM all_all_tables WHERE owner = :src_schema
UNION
SELECT sequence_name AS object_name FROM all_sequences WHERE sequence_owner = :src_schema
);
 
 

Comments