background service testing found an error unique constraint on inserting data into the oracle database table, as follows:
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST53.SYS_C0032604) violated ### The error may exist in class path resource [sqlmapper/ACMClaimMapper.xml] ### The error may involve com.las.core.dal.dao.ACMClaimMapper.insert-Inline ### The error occurred while setting parameters ### SQL: insert into TBL_ACM_CLAIM ( SEQ_NO, ACCT_NO, FUND_CHANNEL,STATUS,CREATE_DATE,CSM_NAME,CSM_CARD,LOAN_DATE,LOAN_AMT ) values ( ?,?,?,?,?,?,?,?,?) ### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST53.SYS_C0032604) violated ; SQL ; ORA-00001: unique constraint (TEST53.SYS_C0032604) violated ; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST53.SYS_C0032604) violated
according to the tip of the index number, found in the table field “SEQ_NO”, found that is because the test database is by another database synchronization, automatic sequence number in the table were disrupted, lead to the next when inserting data, automatically generates SQL serial number in the table has data, so the error led to the only constraints. Of course, data deletion errors and human error operations can cause this problem.
first, we can query where the sequence number of this table is located (my table is TBL_ACM_CLAIM) :
select SEQ_ACM_CLAIM.NEXTVAL from DUAL
do not execute this SQL, because if it is not executed once, the index will increase by +1. If the value of SEQ_NO in the table is greater than the value of the query, the index value will be updated. Set the sequence step size to 100 (usually 1). Execute the following SQL:
alter sequence SEQ_ACM_CLAIM increment by 100
note: SEQ_ACM_CLAIM is not a table name, and the index value cannot modify the current value, but can only be modified to increase, not decrease.
query all indexes:
select * from user_sequences;
drop sequence SEQ_ACM_CLAIM;
CREATE UNIQUE INDEX SEQ_ACM_CLAIM ON TBL_ACM_CLAIM(SEQ_NO);
delete library to run road, one second is enough.
- Pg_dump Error: pg_dump: No matching tables were found，pg_dump: schema with OID 1515227 does not exi
- DB2 SQL error: sqlcode = – 803, sqlstate = 23505, sqlerrmc = 2 [solution]
- Failed to add the foreign key constraint. Missing index for constraint ‘stu_ibfk_1’ in the reference
- mysql ERROR 1050 (42S01): Table already exists
- How to make the import complete smoothly!
- E11000 duplicate key error collection in mongodb
- Creation and use of Oracle sequence
- 1822 – Failed to add the foreign key constraint. Missing index for constraint ‘tb_emp_ibfk_1’ in the
- DM database data migration DTS error solution
- Pymong adds a unique index pymongo. Errors. Duplicatekeyerror
- Ora-02292: integrity constraint (XX) violated – child record found foreign key Association, record cannot be deleted
- About MySQL error: subquery returns more than 1 row
- Error generating Ca in OpenSSL: TXT_ DB error number 2
- Solution of Greenplum query calling function error
- [reprint and save] MySQL does not set the primary key and uses the self growing ID method
- Ctfhub error injection
- greendao insert data UNIQUE constraint failed: PURCHASE_ORDER_TABLE._id (code 1555)
- MySQL error 1451 23000 foreign key exception handling
- MySQL – ERROR 1146 (42S02): Table ‘mysql.user’ doesn’t exist
- How to Solve mybatis returns null when querying Oracle database with char type field