Created
September 8, 2017 18:12
-
-
Save mtcoffee/038c5794ac1b70825fd2c902e8b9665e to your computer and use it in GitHub Desktop.
PL/SQL Script to delete all public synonyms for a schema
This file contains 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
SET serveroutput ON | |
BEGIN | |
FOR cur_syn IN (SELECT synonym_name | |
FROM all_synonyms | |
WHERE table_owner = upper('schema_user')) | |
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 || '!'); | |
END; | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment