background:
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
cause:
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.
resolved:
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.
hint:
query all indexes:
select * from user_sequences;
delete index:
drop sequence SEQ_ACM_CLAIM;
Create indexes:
CREATE UNIQUE INDEX SEQ_ACM_CLAIM ON TBL_ACM_CLAIM(SEQ_NO);
summary:
delete library to run road, one second is enough.
Read More:
- greendao insert data UNIQUE constraint failed: PURCHASE_ORDER_TABLE._id (code 1555)
- django.db.utils.IntegrityError: UNIQUE constraint failed: auth_user.username
- python sqlite Error IntegrityError: UNIQUE constraint failed: table_area1.user_name
- The solution of duplicate entry ‘for key’ primary ‘when inserting data in MySQL
- Failed to add the foreign key constraint. Missing index for constraint ‘stu_ibfk_1’ in the reference
- 1822 – Failed to add the foreign key constraint. Missing index for constraint ‘tb_emp_ibfk_1’ in the
- Pymong adds a unique index pymongo. Errors. Duplicatekeyerror
- Several common methods of inserting pictures into latex documents
- Python implements inserting content in the specified position of text
- Depending on the custom component jar package, unable to read meta data for class appears after startup
- Endnote inserting documents causes word to crash! ! Solution
- How to use the menu of elementui unique opened sidebar
- np.unique Usage of ()
- circuit_breaking_exception,“reason“:“[parent] Data too large, data for [<http_request>]
- Mysql error 1452 – Cannot add or update a child row: a foreign key constraint fails
- Ora-02292: integrity constraint (XX) violated – child record found foreign key Association, record cannot be deleted
- Inconsistency between adapter data and UI data after dragging recyclerview (data disorder)
- MySql ERROR CODE:1215 Cannot add the foreign key constraint
- Solution to error 1452: cannot add or update a child row: a foreign key constraint failures in MySQL
- MYSQL ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails