23, 42, RDF and more
Oracle: Drop All Trigger and Drop All Database
To drop all triggers in a schema, simply execute:
begin for i in (select trigger_name,owner from dba_triggers where trigger_name like '%') LOOP execute immediate 'DROP TRIGGER '||i.owner||'."'||i.trigger_name||'"'; END LOOP; END;
To get drop queries for all tables in a schema, simply execute:
select 'drop table '||table_name||' cascade constraints;' from user_tables;
or you can get drop queries for all user objects in a schema by executing:
select 'drop ' || object_type || ' ' || object_name || ';' from user_objects where object_type != 'INDEX'