-- remember to connect first as the user/owner of the objects you want to drop. Do NOT run this as another user or SYS
declare
del_objs integer;
obj_del integer;
cursor get_objs is
select object_type,
'"'object_name'"'decode(object_type,'TABLE' ,' cascade constraints',null) obj_nam
from user_objects
where object_type in ('TABLE',
'VIEW',
'PACKAGE',
'SEQUENCE',
'PROCEDURE',
'FUNCTION',
'SYNONYM', 'MATERIALIZED VIEW')
order by object_type;
cursor get_objs2 is
select object_type, '"'object_name'"' obj_nam
from user_objects
where object_type in ('TYPE');
begin
for objrec in get_objs loop
execute immediate ('drop 'objrec.object_type' ' objrec.obj_nam);
end loop;
for objrec in get_objs2 loop
begin
execute immediate ('drop 'objrec.object_type' ' objrec.obj_nam);
exception
when others then
null;
end;
end loop;
end;
/
-- Remember to Purge the Recylebin if you are using 10g
purge recyclebin
/
-- Comfirm all is dropped
select * from user_objects
/
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment