Hi Guys ,
I am still new to the db2 world so pls help me with the
following :
I have 2 tables A & B in different databases . They can be joined on a
customer_number column. I have to archive all the data from A which is
more then 30 days old in a seprate table ( say arch_a) . For all the
archived data from A , I also have to archive related data from B in a
separate table( say arch_B) (again joined by customer number) and once
the data has been inserted in both the archived tables, It must be
deleted from the original tables(a and B).
Had it been oracle , I would have used a cursor to process the data
from A and then for each record from A , the related record from B . I
also would have used a db link to access B as its in another database.
But how could I achive the same thing in DB2 ? My challneges are :
1. How to access table B along with A as they are in different
databases ( I guess I may have to use Fedarated database)
2. How to process 30 day old data from A and then for each record
related data from B and then archive them into archived tables and in
the end delete them from the source ? ( Does db2 have cursor
functionality ? Any place where I can see examples )
3. Also how can i ensure that the archive process completes in its
entirity maintaining consistency? If there is any problem during
process , everything should rollback .(
Sorry for a long description.
Pls help.
Thanks.