Hi All,
I am using one of the Datastage functions which is KeyMgtGetNextValue("abc") where abc is the table name in two jobs . when i run the 1st job its working fine , and then if i run the 2nd job , i am getting an error saying that 'unique constraint violated'. So can we use KeyMgtGetNextValue("abc") in two different jobs or should i need to change the 'abc' to 'def' in 2nd load. Can you please let me know what is the best way to generate a surrogate key value where i am loading Data from different Data in different jobs , so thats why i used KeyMgtGetNextValue("abc") in different jobs but still getting an error when i run the 2nd job after i am done with my 1st job.
Any help is really appreciated
Thanks in advance
KeyMgt Function
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The argument supplied to this routine is the name of the sequence (a name internal to DataStage), not necessarily the name of a table. Looks like the second table already has the "next" key. You need to check for this, or initialize the sequence, or use independent sequences, or some combination thereof.
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.
Yes, "abc" is your sequence name in the Key Mgt routines as both Ray and I have pointed out to you. Now, it may match the name of the target table you are using the generated key for but that's hardly necessary. And if you have multiple jobs targeting the same table then they should all use a common sequence.
One consideration is concurrency, could the two jobs be loading the same table at the same time? That would change the routine you would need to use.
One consideration is concurrency, could the two jobs be loading the same table at the same time? That would change the routine you would need to use.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers