Wednesday, October 12, 2011

Script to create synonyms using dynamic sql

Visit the Below Website to access unlimited exam questions for all IT vendors and Get Oracle Certifications for FREE
http://www.free-online-exams.com

--------------------------------------
-- Script to create synonyms using dynamic sql


---------------------------------------

SET ECHO OFF FEED OFF

SET PAGES 1000 LINES 200 HEAD OFF


ACCEPT MTUSER PROMPT "Enter user to create Synonym for (TARGET) :"
accept likeuser prompt "Enter like user id (SOURCE) :"

spool syn_&mtuser..sql


select 'create synonym &MTUSER..'||SYNONYM_NAME||' '||' FOR '||
TABLE_OWNER||'.'||TABLE_NAME||' ;'
FROM DBA_SYNONYMS
WHERE OWNER='&LIKEUSER'
/



spool off

ed syn_&mtuser..sql

PROMPT Run the output file syn_&mtuser..sql



Get Oracle Certifications for all Exams
Free Online Exams.com

No comments: