/* Formatted on 6/23/2014 10:31:21 AM (QP5 v5.115.810.9015) */
DECLARE
CURSOR cur_synonym (p_user varchar2
)
IS
SELECT 'CREATE SYNONYM '
|| p_user
|| '.'
|| db.object_name
|| ' FOR APPS.'
|| db.object_name
sql_stmt
FROM dba_objects db
WHERE db.owner = 'APPS';
v_user VARCHAR2 (20) := 'USER_NAME';
BEGIN
FOR i IN cur_synonym (v_user)
LOOP
EXECUTE IMMEDIATE i.sql_stmt;
DBMS_OUTPUT.put_line ('Command : ' || i.sql_stmt);
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error: ' || SQLERRM);
END;
DECLARE
CURSOR cur_synonym (p_user varchar2
)
IS
SELECT 'CREATE SYNONYM '
|| p_user
|| '.'
|| db.object_name
|| ' FOR APPS.'
|| db.object_name
sql_stmt
FROM dba_objects db
WHERE db.owner = 'APPS';
v_user VARCHAR2 (20) := 'USER_NAME';
BEGIN
FOR i IN cur_synonym (v_user)
LOOP
EXECUTE IMMEDIATE i.sql_stmt;
DBMS_OUTPUT.put_line ('Command : ' || i.sql_stmt);
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error: ' || SQLERRM);
END;
-- Please give the User Name in v_user variable
No comments:
Post a Comment