
D
I ❤️ Oracle APEX
begin for cur_rec in (
select
object_name,
object_type
from
user_objects
where
object_type in (
'TABLE', 'VIEW', 'MATERIALIZED VIEW', 'PACKAGE',
'PROCEDURE', 'FUNCTION', 'SEQUENCE', 'SYNONYM'
)
)
loop
begin if cur_rec.object_type = 'TABLE' then
execute immediate
'DROP ' || cur_rec.object_type || ' "' || cur_rec.object_name || '
" CASCADE CONSTRAINTS';
else
execute immediate 'DROP ' || cur_rec.object_type || ' "' || cur_rec.object_name || '"';
end if;
exception when others then DBMS_OUTPUT.put_line (
'FAILED: DROP ' || cur_rec.object_type || ' "' || cur_rec.object_name || '"'
);
end;
end loop;
end;
/