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!

What's the best way to delete multiple rows from multiple tables?

2Luke2Feb 10 2014 — edited Feb 10 2014

So, I'm a DBA, but I rarely write pl/sql mostly just sql queries with simple joins etc. I'm more of a troubleshooter/admin, but I'm trying to do some data cleanup on a database and I'm sure I could make it work, but I thought this would be a good opportunity for me to expand my abilities and learn a bit more. What I'm looking for is someone to point me in the right direction so I can do the research and learn what I need to know to accomplish my goal.

What I have is about 42 tables that all have related data. What I'm trying to do is cleanup the data on a regular basis, but I'm not sure how I should go about doing this when there are that many tables involved. Would something like cursors be my go to here or something that I currently have no knowledge of currently? What I'm not looking for is to be hand fed, just need a bit of guidance to point me in the right direction.

I have two main tables that are at the top of the food chain so to speak. When I delete data from these two tables there are a ton of tables that are related to the data inside of these two tables. So I need to delete all that data as well to make sure I don't have an orphaned records. Now this is a homegrown application, but not by me, so I'm still learning the layout myself.

If you have any ideas I could try I would greatly appreciate the help. I'm currently using 10gR2 EE.

Thanks!

-Luke

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2014
Added on Feb 10 2014
5 comments
2,393 views