View previous topic :: View next topic |
Author |
Message |
edkir98 Beginner

Joined: 27 Aug 2007 Posts: 102 Topics: 42 Location: Chennai
|
Posted: Mon Feb 15, 2010 9:53 am Post subject: Fetch, Write and Delete |
|
|
We have a master table and around 10 child tables. What we do now is when a timestamp is passed to the program it fetches the parent row one by one, then fetches the equivalent child rows in all the tables, writes them to a file and deletes all the child rows and then the parent row at last.
Is there a way to do this more efficiently using UNLOAD, SORT, LOAD etc.
The way it is working now
Code: | 1) Fetch row from master table
2) Write it to a master file
3) Fetch equivalent child row from child table 1.
4) Write it to a Chile file 1.
5) Delete this child row in child table 1.
6) Fetch equivalent child row from child table 2.
7) Write it to a Chile file 2.
8) Delete this child row in child table 2
.
.
.
Repeat the same process for all the 10 child tables
.
.
15) Delete the parent row
16) Repeat step 1 |
Did i make it clear? Please help
Thanks _________________ Thanks |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Feb 15, 2010 11:28 am Post subject: |
|
|
edkir98,
Assuming the child tables are defined with DELETE CASCADE
1. Unload the Parent table and all the child tables
2. Reload the parent table with dummy.
3. Cascade delete will delete all the child table rows
4. Run a utility to remove the copy pending on parent and child tables
Kolusu |
|
Back to top |
|
 |
|
|