If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQL0803N One or more ...SQLSTATE=23505,

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-07-04, 07:28
a7man a7man is offline
Registered User
 
Join Date: May 2004
Posts: 7
SQL0803N One or more ...SQLSTATE=23505,

I hit with the above error msg...the exact msg is...

SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1"
constrains table "TABLEA" from having duplicate rows for those columns. SQLSTATE=23505

What puzzle me is that i have look at the loading data and found none of them exists in TABLEA.

can anyone help ?

Thks!!!
Reply With Quote
  #2 (permalink)  
Old 05-07-04, 08:16
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Run the following query:

SELECT INDNAME, INDSCHEMA
FROM SYSCAT.INDEXES
WHERE IID = <index-id>
AND TABSCHEMA = 'schema'
AND TABNAME = 'table'

Use the appropriate values for schema and table for your error.
This will tell you which index is causing the duplicate error. Then
chack your data closely to locate the duplicates. If you are having problems
finding the duplicates, load the data into an identical table without any constraints (no PK, indexes, and constraints). Then run a query on that table like: SELECT indcol1,indcol2,...,indcoln,count(*) as qty from newtable group by indcol1,indcol2,...,indcoln order by qty
where indcol1,indcol2,...,indcoln are all the columns that comprise the index of the first query. This will give you the count of duplicate values of the index (where qty > 1).

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 05-07-04, 12:04
a7man a7man is offline
Registered User
 
Join Date: May 2004
Posts: 7
Hi Andy....

Thanks for the help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On