Hi,
I want to truncate the target table only when the record comes from source system. My source table is in oracle database and target database is in DB2. The requirement is to move the record from source to target if record exists in the source tables, if no record exists in the source then we need to the use existing data in the tables.
Any suggestion how to implement this logic without using routine.
Thanks,
Truncate only record exists
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 40
- Joined: Tue Oct 14, 2008 3:30 pm
- Location: London
Somewhat lost regarding what it is you need to do.
Are you saying that if there are records in the Oracle table, that you need to truncate the DB2 table and then write all of the Oracle records into the DB2 table? But if the source Oracle table is empty, then you need to do nothing on the DB2 side... i.e. leave the target table alone and intact?
Are you saying that if there are records in the Oracle table, that you need to truncate the DB2 table and then write all of the Oracle records into the DB2 table? But if the source Oracle table is empty, then you need to do nothing on the DB2 side... i.e. leave the target table alone and intact?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Use a sequence with two Job activities. The first job determines whether there are any rows in the table and parks that result, say in its user status area. This activity has a custom trigger that fires only if that count is greater than zero. The second Job activity performs the truncate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.