View previous topic :: View next topic
|
Author |
Message |
thisak
New User
Joined: 09 Jun 2006 Posts: 14
|
|
|
|
I have a Table A and when a column update take place, then certain records from Table B should be deleted (i.e. using WHERE) and in Table C, a column should be updated. Can we do these kind of bulk deletion and bulk update using DB2 Trigger?
If possible, provide me sample or reference code. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Why do you need to handle them in Trigger and not in Application program itself?? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Sounds like the "trigger" is a solution looking for an opportunity . . .
As PB asks, why use a trigger? |
|
Back to top |
|
|
thisak
New User
Joined: 09 Jun 2006 Posts: 14
|
|
|
|
I'm not sure when will update take place in Table A. There should some watchdog to monitor the table and trigger job. Not sure how can we do this?
Or thro CICS program, again I'm not sure whether a Transaction will start by DB update? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe this is being made more difficult than it needs to be . . .
In the code, when "something" happens, do everything in the code - no need to involve something else.
Possibly i misunderstand. If you explain in more detail, we may be able to offer more/other suggestions. |
|
Back to top |
|
|
thisak
New User
Joined: 09 Jun 2006 Posts: 14
|
|
|
|
Ok... let me add more detail to it.
There are 2 processes taking place, one is in Mainframe and other is in external system (Java environment). Everyday, we are not sure which process will complete first and each of it doesn't have fixed end time. But, once they both are completed, they can alert either sending MQ message OR by updating flags in DB2 table (say Table A).
Only when above said 2 processes are completed, subsequently deletion and updation should take place in Table B & C respectively.
Please see attachment as well. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I still see no need for a trigger . . .
Whatever determines that both are done should be able to do all of the work needed. What am i missing? |
|
Back to top |
|
|
|