|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Duplicate key - at a loss
From: Ruth, Brice (BRuth
Fiskars.com)
Date: Tue Feb 22 2005 - 21:54:46 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Folks, I'm at a loss. I've been banging my head against the simplest of
problems, it would seem, but with no resolution. To begin with, I have a
table that was defined like so:
CREATE TABLE "FISKARS"."W58IBPICDTAW"
(
"PDUPCN" Char (14) ASCII NOT NULL,
"PDIMGN" Varchar (32) ASCII NOT NULL,
PRIMARY KEY ("PDUPCN", "PDIMGN")
)
I have a J2EE web application that inserts into this table. Somehow, I
am able to get a "Duplicate key" error from an insert immediately after
I dropped all rows in this table, via SQL Studio. So, unable to explain
this, I removed the primary key constraint. The insert worked - OK,
nice. Immediately following the insert, I copy the inserted row to a
"production" table, from the "work" table. The definition of the
"production" table is identical to this, save the name. The SQL I use to
accomplish this is simple:
INSERT INTO
W58IBPICDTA
(PDUPCN,PDIMGN)
SELECT
PDUPCN,
PDIMGN
FROM
W58IBPICDTAW
WHERE
PDUPCN=#upc#
AND PDIMGN=#imageName#
The #upc# and #imageName# are references in my persistence layer to
subsitute in values passed in from a Javabean. The persistence layer I
am using is iBATIS 2.0.9. Now, I have verified that the parameters I am
passing in DO NOT exist in the target table. The UPCN exists, but a
unique IMGN is generated. Since the primary key is a composite of these
two fields, it should succeed, right?!
Furthermore, when I do a query like so:
select pdupcn,count(pdupcn) as cnt from w58ibpicdta group by pdupcn
order by cnt desc
I get a result set that shows that many UPCNs have more than one entry
(as designed, this was the point). What the HECK is causing the
duplicate key error to be thrown?!
I'm running against version 7.5.00.08 of MaxDB for Windows 2000.
I'm at my whits end here, please, please help!!
Respectfully,
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]