2007-06-18

Create mass synonyms

Imagine that you have a user A that has given several permissions to another user B and you need to create synonyms in B for the objects in A (user B must have the "create synonym" privilege).
An easy way to create those synonym is using the output of the following code (exchange &owner for your user A if you are using SQL Plus (otherwise SQLPlus asks you for the variable value).

select 'create synonym '||object_name||' for '||owner||'.'||object_name||';' from all_objects where owner='&owner';

No comments:

Post a Comment

Os comentários são moderados.
The comments are moderated.