Posted By

kamilch on 08/17/10


Tagged


Versions (?)

CREATE SYNONYMS


 / Published in: PL/SQL
 

  1. src_schema VARCHAR2(256) := 'EMPIK_DYNAMO_01';
  2. target_schema VARCHAR2(256) := 'EMPIK_PORTAL_BETA_1';
  3. CURSOR src_objects IS
  4. SELECT table_name AS object_name FROM all_all_tables WHERE owner = src_schema
  5. SELECT sequence_name AS object_name FROM all_sequences WHERE sequence_owner = src_schema;
  6. FOR next_row IN src_objects LOOP
  7. EXECUTE IMMEDIATE 'CREATE or REPLACE SYNONYM ' || target_schema || '.' || next_row.object_name || ' for ' || src_schema || '.' || next_row.object_name;
  8. DBMS_OUTPUT.put_line('ERROR WHILE CREATING SYNONYM FOR: ' || next_row.object_name);
  9. DBMS_OUTPUT.put_line(SQLERRM);
  10. END;
  11. /

Report this snippet  

You need to login to post a comment.