/** ----------------------------------------------------------------------------------- Author : Peter Tesone Description : Drops all objects in the current schema. Take careful !!! Platforms : 8i,9i,10g. **/ ----------------------------------------------------------------------------------- begin -- constraint cursor for cur_con in (select table_name, constraint_name from user_constraints where constraint_type = 'R') loop -- drop constraint execute immediate 'alter table ' || cur_con.table_name || ' drop constraint ' || cur_con.constraint_name; -- show constraint removed dbms_output.put_line('constraint name :' || cur_con.constraint_name); end loop; -- object cursor for cur_obj in (select object_name, object_type from user_objects) loop begin -- drop object execute immediate 'drop ' || cur_obj.object_type || ' ' || cur_obj.object_name; -- show object removed dbms_output.put_line(cur_obj.object_type || ' name :' || cur_obj.object_name); exception when others then null; end; end loop; end;