Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete child records

Status
Not open for further replies.

Muskaan

Programmer
Oct 21, 2002
47
0
0
US
Hi All,
I am using a database in which foreugn key relationship is not enforced at the database level but at the application level.

I am working on archiving an OLTP database, in which, after saving records older than, say, 1 year, into another database, these records should be deleted from the OLTP database.

How can I delete child records based on a condition applied on one of the records of the parent table.

Say parent_table is :
Col1 varchar2
Col2 varchar2
Col3 DATE

and child_table is:
Col1 varchar2
Col2 varchar2

I need to delete from child_table when the corresponding parent table record's DATE Col3 is more than 12 months old.

How can I do that ?
Any help will be highly appreciated.
 
I think you can achieve it by writing triggers for after delete or before delete records in the parent table.

please let me know if it does not work for you
 
I will be deleting millions of records during the Archival process. Triggers will greatly slow down the process... even make it impossible! what do you think ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top