View previous topic :: View next topic
|
Author |
Message |
nidhimishra_8
New User
Joined: 26 Nov 2008 Posts: 5 Location: Bangalore
|
|
|
|
Hi,
I am getting -803 error while loading data in DB2.
The data which i am trying to insert is some new entries and doesn't exist in table.
There are 3 Primary keys in which 1 is time stamp and while loading we give it as current time stamp, so there is no chance of duplicate entries.
Please advise how to resolve it.
Thanks,
Nidhi |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
so there is no chance of duplicate entries.
|
your analysis sucks. db2 said there is a duplicate.
Look at the sqlca and it will provide you with the index that is being violated.
Display it after receiving the -803.
or, add a little professionalism to your code
and call dsntiar with the sqlca after a -803 which will format the output
for display. |
|
Back to top |
|
|
arvind.m
Active User
Joined: 28 Aug 2008 Posts: 205 Location: Hyderabad
|
|
|
|
display the key where you are getting the SQLCODE=-803. There must be some duplicate records.
Quote: |
There are 3 Primary keys in which 1 is time stamp and while loading we give it as current time stamp, so there is no chance of duplicate entries.
|
when one of key for all records is current timestamp then there is a chance of having records with 2 primary keys being same. DISPLAY is the best way to find the bad record. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you will receive a -803 on insert when any unique index is violated.
debugging -803's involves more then only concentrating on the 'PRIMARY' index.
Normally, this is known by the coder
- primary index violations afflict programs written by blind people
...problems occur when the coder/designer does an incomplete job of analysis by ignoring other indexes.
that is why I suggested looking at the sqlca
one should first look at the contents of the sqlca when receiving negative sql codes.
in the case of a -803, you first have to establish which index is being violated unstead of assuming that it is the primary.
so, stop pissing around swearing that there could not be duplicates and
1) determine the index being violated
2) use sort to find the dups (based on the offsets of the columns involved with the violated index) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Please advise how to resolve it. |
review Your analisys and coding
I would trust db2 judgment
more than Your' s or that of Your team or that of Your support |
|
Back to top |
|
|
|