Hi,
We are doing a table refresh i.e we are loading the data from a sequential file to table. I have an id column in the table which should be unique. I am passing outrownum as the value for that. But the job is aborting with unique constraint violation. how is this possible.
i changed the job to take the id from the routine KeyMgtGetNextValue('n') and it is not giving any violation.
but i dont want to use this routine because i want the id to start from 1 everytime i load
can anyone help me with this
duplicates in outrownum
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The target table already has rows in it. @OUTROWNUM always starts from 1. You need to determine the current maximum key value before your job processes any rows, perhaps loading it into a hashed file with a constant key, and add this value to @OUTROWNUM.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
@OUTROWNUM can never violate a unique constraint on a truncated table. Check for any other unique constraints that there may be. Check too that you are loading the column that you think you are with this sequence of integers - that is, verify that the design is doing what it is supposed to be doing. Look carefully at the error message; it should name the constraint, and you can then track it down in a more targeted fashion.
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.