Wednesday, March 7, 2012

Delete Triggers/Procedures...

What's the SQL statement that will allow me to delete all the triggers and procedures that I have created. (I don't remember the names of the procedures and triggers, but would like to clear everything). Thanks.If you can connect to the schema which created those triggers & procedures, you can get the names by querying the user_objects views.

select object_type, object_name
from user_objects
where object_type like 'PROC%' or object_type like 'TRIG%';

And to delete all the above, issue these sqls:

sql> set feedback off
sql> set termout off
sql> spool c:\temp\droptrigproc.sql
sql> select 'drop '||object_type||' '||object_name
2> from user_objects
3> where object_type like 'PROC%' or object_type like 'TRIG%';
sql> spool off
sql> @.c:\temp\droptrigproc.sql

Before doing the above, make sure you are NOT deleting other required objects !

Or the fastest way to cleanup would be to drop the schema/user and recreate it.

Originally posted by VB_Oracle
What's the SQL statement that will allow me to delete all the triggers and procedures that I have created. (I don't remember the names of the procedures and triggers, but would like to clear everything). Thanks.

No comments:

Post a Comment