-- Run this when dropping fails due to integrity constraints. -- This script destroys undeleted data. ----- PHOTOS ----- create table pl_photos as select object_id as photo_id from acs_objects where object_type = 'pl_photo'; declare v_gc_installed_p integer; cursor cur is select photo_id as id from pl_photos; begin select count(1) into v_gc_installed_p from user_tables where table_name = 'GENERAL_COMMENTS'; for photo in cur loop if v_gc_installed_p = 1 then execute immediate 'begin for message in (select comment_id as id from general_comments where object_id = ' || photo.id || ') loop acs_message.delete(message.id); end loop; end;'; end if; delete from acs_permissions where object_id = photo.id; acs_object.delete(photo.id); end loop; acs_object_type.drop_type('pl_photo'); end; / show errors drop table pl_photos; ----- FOLDERS ----- create table pl_folders as select object_id as folder_id from acs_objects where object_type = 'pl_folder'; declare cursor cur is select folder_id as id from pl_folders; begin for folder in cur loop delete from acs_permissions where object_id = folder.id; acs_object.delete(folder.id); end loop; acs_object_type.drop_type('pl_folder'); end; / show errors drop table pl_folders;