IBM Support

SQL map that accesses an Oracle database fails with a Unique Constraint error *|* -7FDA1432130F9C1585257918007D4C3E- *|*

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

SQL map fails with Duplicate Key Violation error when it tries to update values to an Oracle database.
Created the data in a MS SQL database and re-created the map and translation is successfull.
Error Message

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

[{"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Product":{"code":"SS73G6","label":"Sterling Total Payments for Financial Services"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
12 October 2021

UID

ibm10767315