Created
November 7, 2018 10:56
-
-
Save trang1/daff5c9fed567a46bbefad86e5e38d78 to your computer and use it in GitHub Desktop.
Oracle PL/SQL - How to delete all public synonyms for a schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
FOR cur_syn IN (SELECT synonym_name | |
FROM all_synonyms | |
WHERE table_owner = 'somebody') | |
LOOP | |
BEGIN | |
EXECUTE IMMEDIATE 'drop public synonym ' || cur_syn.synonym_name ; | |
EXCEPTION | |
WHEN OTHERS | |
THEN | |
DBMS_OUTPUT.PUT_LINE ('Failed to drop the public synonym ' || cur_syn.synonym_name || '! ' || sqlerrm); | |
END; | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment