ORACLE's Solution to Violation of Unique Constraints
Java code error:
Java.sql.batchupdateexception: ora-00001:violated the unique constraint (TTT.table).
at Oracle . JDBC . driver . database error . throwbatchupdateexception(database error . Java:629)
It is located at Oracle. JDBC. driver.oraclepreparedstatement.executebatch (oraclepreparedstatement.java: 9447).
At Oracle.jdbc.driver.oraclestatementrapper.executebatch (oraclestatementrapper.java: 211).
Located at sun. reflect. nativemethodaccessompl. invoke0 (local method)
Located at sun.reflect.nativemethodaccessompl.invoke (nativemethodaccessompl.java: 39).
Located at sun.reflect.delegatingmethodaccessompl.invoke (delegatingmethodaccessompl.java: 25).
Located in java.lang.reflect.method.invoke (method.java: 597).
Error inserting data manually:
Solution:
1. Use sql to query the unique constraint of the primary key. Current maximum:
Select max(id) from the table; (id is of numeric type)
Select max (to _ number (id)) from the table; (id is of non-numeric type)
2. Use sql to query the next value of the table sequence.
Select SEQ. Nextval of dual (SEQ is the sequence name of the corresponding table)
3. Finally, use PL/SQL client to edit the sequence, and modify the next value of the sequence to be greater than the maximum value in the table to solve the problem.