Delete efficiency can be improved by joining the table yourself using rowid. It can even be optimized using volumetric collection and FORALL
DECLARE limit_in integer; CURSOR C1 is Select min(b.rowid) from table_name a, table_name b where a.primary_key = b.primary_key; TYPE C1_rec IS TABLE OF C1%ROWTYPE INDEX BY PLS_INTEGER; C1_record C1_rec BEGIN limit_in:=10000
The table to be deleted has child tables. Thus, the restriction will be violated.
So, before executing the above code snippet, this is the best option to change the foreign key constraint to REMOVE CASCADE. We cannot change the restriction to add the delete cascade. Thus, the foreign key must be reset and recreated to remove the cascade
ALTER child_table ADD CONSTRAINT fk_name foreign_key (C1) references parent_table (C2) on delete cascade;
Delete cascade will also clear your child tables.
source share