chaitu chaitu
asked on
java.sql.SQLIntegrityConstraintViolationExc eption: ORA-00001: unique constraint
Hi,
we are getting unique constraint ,Do we get this error while inserting same ID value into the table only or is there any other reason?
during update statement also also do we get this error?
org.springframework.dao.Du plicateKey Exception:
### Error updating database. Cause: java.sql.SQLIntegrityConst raintViola tionExc
eption: ORA-00001: unique constraint (TESTSANDBOX.SYS_C0040162) violated
### The error may involve alfresco.propval.parameter _IdPropert yRoot
### The error occurred while setting parameters
### Cause: java.sql.SQLIntegrityConst raintViola tionExcept ion: ORA-00001: unique
constraint (TESTSANDBOX.SYS_C0040162) violated
; SQL []; ORA-00001: unique constraint (TESTSANDBOX.SYS_C0040162) violated
; nested exception is java.sql.SQLIntegrityConst raintViola tionExcept ion: ORA-000
01: unique constraint (TESTSANDBOX.SYS_C0040162) violated
we are getting unique constraint ,Do we get this error while inserting same ID value into the table only or is there any other reason?
during update statement also also do we get this error?
org.springframework.dao.Du
### Error updating database. Cause: java.sql.SQLIntegrityConst
eption: ORA-00001: unique constraint (TESTSANDBOX.SYS_C0040162)
### The error may involve alfresco.propval.parameter
### The error occurred while setting parameters
### Cause: java.sql.SQLIntegrityConst
constraint (TESTSANDBOX.SYS_C0040162)
; SQL []; ORA-00001: unique constraint (TESTSANDBOX.SYS_C0040162)
; nested exception is java.sql.SQLIntegrityConst
01: unique constraint (TESTSANDBOX.SYS_C0040162)
you get this when violation a unique index
any of the columns given by this query should indicate at what columns to look
(assuming you login with the schema owner TESTSANDBOX)
or use the index_name
any of the columns given by this query should indicate at what columns to look
(assuming you login with the schema owner TESTSANDBOX)
select ui.index_name, ui.table_name, uic.column_name
from user_indexes ui, user_ind_columns uic
where ui.uniqueness = 'UNIQUE'
and ui.index_name = uic.index_name
and ui.table_name = uic.table_name
and ui.table_name = 'your table'
order by 2, 1
or use the index_name
select ui.index_name, ui.table_name, uic.column_name
from user_indexes ui, user_ind_columns uic
where ui.uniqueness = 'UNIQUE'
and ui.index_name = uic.index_name
and ui.table_name = uic.table_name
and ui.index_name = 'SYS_C0040162'
order by 2, 1
Can you post your update query and the output from the following query?
select uc.constraint_name, ucc.column_name, uc.constraint_type
from user_constraints uc, user_cons_columns ucc
where uc.table_name = ucc.table_name
and uc.constraint_name = ucc.constraint_name
and uc.table_name = 'YOURTABLE'
and uc.constraint_type in ('P','U','R');
select uc.constraint_name, ucc.column_name, uc.constraint_type
from user_constraints uc, user_cons_columns ucc
where uc.table_name = ucc.table_name
and uc.constraint_name = ucc.constraint_name
and uc.table_name = 'YOURTABLE'
and uc.constraint_type in ('P','U','R');
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
check the documentation below for more info:
Class SQLIntegrityConstraintViol
https://docs.oracle.com/javase/7/docs/api/java/sql/SQLIntegrityConstraintViolationException.html
scroll down to Constructor Detail section for more info.