Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

on delete cascade vs explicit delete statement

913578Jul 18 2013 — edited Jul 19 2013

Hi,

I have a table item_master. it has child tables item_cost and item_sell.

I want to perform deletion on item_master table, to do this i have to first delete records from child tables.

so instead of deleting from the child tables manually can i make item_master table as on delete cascade to ensure oracle automatically delete the records from child tables.

or i should write delete statementes for child tables? which one is faster?

begin

delete from item_sell where item_id in (select item_id from item_master where expire_time>sysdate-1);

delete from item_ where item_id in (select item_id from item_master where expire_time>sysdate-1);

delete from item_master where expire_time>sysdate-1;

commit;

end;

/

Thanks,

Vinod

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2013
Added on Jul 18 2013
7 comments
2,624 views