469,928 Members | 1,848 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

Possibly dumb IBM DB2 v8 triggers question

2
Hi,
I'm using IBM DB2 v8 on z/OS

I'm trying to create a trigger on INSERT on table A.
The trigger will copy the new row on to a shadow table A_SW and then it gets complex and I get confused.
I need to then select multiple rows from table B using a key from inserted row on table A, and copy those to a shadow table B_SW.

The problem is linking the rows on B_SW to the row on A_SW that caused them to be created. I've tried to do this by setting an identifier column on A_SW and then using SELECT GUID FROM FINAL TABLE to get the identifier that was created by DB2 on A_SW and try to put that on the rows on B_SW.
But I cannot get any SQL that will behave.
I think I'm just being dumb, but is this in fact possible and if so how?
Nov 3 '06 #1
1 1526
Herb
13
have you tried using Sequences....you could use NEXTVAL in A_SW and use PREVAL for the rows you insert into B_SW
Nov 24 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by rick | last post: by
4 posts views Thread by --CELKO-- | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.