Question & Answer
Question
SQL map that accesses an Oracle database fails with a Unique Constraint error *|* -7FDA1432130F9C1585257918007D4C3E- *|*
Answer
Technote (troubleshooting)
Problem(Abstract)
SQL map that accesses an Oracle database fails with a Unique Constraint error
Symptom
ORA-00001: unique constraint (PK_Name) violated
Resolving the problem
Solution
This issue seems to be because of Oracle PreparedStatment bug. The table key column field in the Oracle database is defined as CHAR data type. The value stored in the column is smaller than the max size so the database pads the value with spaces to meet the size requirment.
Please see the link below
http://forums.oracle.com/forums/thread.jspa;jsessionid=8d92200630de527b2f61c7ef4d3296318c855aa88fe1.e34Tb34Lb34PbO0Lb3eTahiPbNyTe0?messageID=504702
This update is failing due to an issue with the Oracle JDBC Driver. There is an issue with the Oracle JDBC driver with CHAR fields and prepared statements to retrieve or update values.The driver is not passing the whitespace on the value; thus the update fails because the value does not match any in the table.
To resolve the issue on the database side modify the column data type to VARCHAR or VARCHAR2. This would require all values in the CHAR fields to be edited and have the whitespace removed.
Padded values can also be passed from the Map.
Historical Number
TRB1479
Was this topic helpful?
Document Information
Modified date:
12 October 2021
UID
ibm10767315