23505 Db2 Error
Contents |
here for a quick overview of the site Help Center Detailed sqlcode=-803 sqlstate=23505 update answers to any questions you might have Meta Discuss the sql0803n sqlstate=23505 workings and policies of this site About Us Learn more about Stack Overflow the company sqlstate 23505 postgres Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join http://www-01.ibm.com/support/docview.wss?uid=swg21508894 the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Db2 .SqlIntegrityConstraintViolationException: SQLCODE=-803, SQLSTATE=23505 up vote 0 down vote favorite 1 I am reading from a table in Oracle and inserting the http://stackoverflow.com/questions/28826508/db2-sqlintegrityconstraintviolationexception-sqlcode-803-sqlstate-23505 entire dump into Db2. The table structures are the same.I am using Simple scala class which does the above mentioned task. I have set the insert batchsize as 300. After a few batches gets updated, the class is throwing the below exception com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: Error for batch element #10: DB2 SQL Error: SQLCODE=-803, SQLSTATE=23505, SQLERRMC=1;PME.TM_ASSET_LQA_DETL, DRIVER=4.13.127 at com.ibm.db2.jcc.am.id.a(id.java:673) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.id.a(id.java:60) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.id.a(id.java:127) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.t4.cb.a(cb.java:481) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.t4.cb.a(cb.java:70) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.t4.q.a(q.java:57) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.t4.tb.a(tb.java:225) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.oo.a(oo.java:3434) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.oo.d(oo.java:5550) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.oo.a(oo.java:4992) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.oo.c(oo.java:4664) ~[db2jcc-4.13.127.jar:na] at com.ibm.db2.jcc.am.oo.executeBatch(oo.java:2934) ~[db2jcc-4.13.127.jar:na] at com.baml.regw.db.replicator.ReplicationRunnable$$anonfun$run$3.apply(SimpleReplicator.scala:105) ~[regw-db-replicator-0.0.933-SNAPSHOT.jar:na] at com.baml.regw.db.replicator.ReplicationRunnable$$anonfun$run$3.apply(SimpleReplicator.scala:80) ~[regw-db-replicator-0.0.933-SNAPSHOT.jar:na] Since the exception was related to IntegrityConstraint I tried checking for presence of Composite primary key(ID+TimeStamp+9999-12-31 00.00.000000) but the combo is neither present in the Oracle table nor the Db2 table. The constraints on thE Db2 table are COLUMN NAME UNIQUE RULE +ID+BUSINESS_STOP+BUSINESS_START Primary +ID Duplicate +BUSINESS_START Duplicate +LOW_QUALI
TWO ROWS CAN CONTAIN DUPLICATE VALUES IN THOSE COLUMNS RID OF EXISTING ROW IS X The table that is http://www.sqlerror.de/db2_sql_error_-803_sqlstate_23505.html the object of the INSERT or UPDATE operation is constrained (by https://www.experts-exchange.com/questions/24086677/DB2-MERGE-throwing-SQLSTATE-23505-duplicate-key-error.html UNIQUE INDEX in the INDEX SPACE indexspace-name to have unique values in certain columns. Completion of the requested INSERT or UPDATE would result in duplicate values occurring in row rid. If a view is the object of the INSERT or UPDATE statement, the table db2 sql that defines the view is constrained. The update might also be caused by a DELETE operation of a parent row that cascades to a dependent row with a delete rule of SET NULL. System action: The INSERT, UPDATE, or DELETE statement cannot be executed. The object table is unchanged. Programmer response: Examine the definitions for UNIQUE db2 sql error INDEX in the INDEX SPACE indexspace-name to determine the uniqueness constraint imposed. Please refer to SYSIBM.SYSINDEXES for the indexspace-name and the associated index-name. For an UPDATE statement, verify that the specified operation is consistent with the uniqueness constraint. If this does not indicate the error, examine the object table to determine the cause of the problem. For an INSERT statement, examine the object table to determine which values violate the uniqueness constraint. If the INSERT statement contains a subquery, match the contents of the table addressed by the subquery and the contents of the object table to determine the cause of the problem. For a DELETE statement, examine the index key columns in the table that defines the index. These columns contain a foreign key, which when set NULL on a cascade delete from the object table, causes the duplicate values. <- BACK TO INDEX This is a free Service. I assume no warranty for misprints, and for the correctness and completeness of information and entries.
Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > DB2 MERGE throwing SQLSTATE 23505 (duplicate key) error Want to Advertise Here? Solved DB2 MERGE throwing SQLSTATE 23505 (duplicate key) error Posted on 2009-01-27 DB2 4 Verified Solutions 10 Comments 11,289 Views Last Modified: 2012-05-06 Hello, I have a stored procedure that starts by doing a MERGE and the clean up old data. The MERGE has an INSERT statement for the NOT MATCHED condition and an UPDATE statement for the MATCHED condition. Is this scenario, I would expect to never find a SQLSTATE 23505 error (duplicate keys) because it was supposed to be an INSERT for new lines or UPDATE for old lines. Any hints, please? Thanks in advance Ricardo Carraretto 0 Question by:riccar Facebook Twitter LinkedIn Google LVL 45 Active today Best Solution byKdo Hi riccar, The problem is in the use of NULLs in some of the columns. DB2 does NOT consider two nulls to be equal, so joining on columns that may contain NULL can result in a "NOT MATCHED" condition. Go to Solution 10 Comments LVL 37 Overall: Level 37 DB2 27 Message Assisted Solution by:momi_sabag2009-01-27 can you post here your statement and the definitions of the indexes you have on your table? if you perform an update statement, that statement might create a duplicate key if the column you change has a unique constraint on it and the new value you assign is equal to an already existing value in a different record 0 Message Author Comment by:riccar2009-01-27 Here it is: CREATE TABLE my_table ( column1 int, column2 timestamp, column3 int, column4 char(40), column5 varchar(255), column5 varchar(255), column7 int, column8 int, column9 int, column10 int, column11 varchar(80), column12 int, column13 int ) ; CREATE UNIQUE INDEX EI36 ON my_table ( column1, column2, column3, column4, column5, column6, column7, column8, column9, column11, column12, column13