View previous topic :: View next topic |
Author |
Message |
pappu47 Beginner
Joined: 10 Jan 2005 Posts: 12 Topics: 4 Location: Hyderabad
|
Posted: Tue Mar 04, 2008 9:32 pm Post subject: Need suggestion on handling cursors in multiple tables |
|
|
I Need to create a flat file when there is any change in history files and if the record have multiple changes in that records i have write all the records(before and after) in to output file.Each field in flat file has corresonding columns in one table.My requirement is to check the each history table and look any change in date field with current date.
if i have multiple changes in particular dates i have capture before and after changes as different records.
Example:
o/p file :
01 out-put-rec.
05 field1 pic x(01).
05 field2 pic x(02).
05 field3 pic x(01).
these fields are in different tables like field1 in Table1 ,field2 in Table2 and field3 in Table3.These fields will be loaded in database whenever any change in these fields either batch or online process.
All the above 3 tables have 3 history tables so my approach is to find change in history tables with key as date field.I am checking current date with date in the hist table field so if any change i am setting switch and finally i am checking all the switches and writing the records.
But if I have any multiple changes any history table i need to capture all the records with before and after changes.
can someone suggest best approach?
Thanks
Pappu |
|
Back to top |
|
|
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Wed Mar 05, 2008 8:18 am Post subject: |
|
|
Instead of 3 history tables just use a change table with triggers on table1, 2, and 3 to insert an entry in the change table when there is a change to the table1, 2, or 3.
Or research the log file and see if you can get you data from that. |
|
Back to top |
|
|
|
|