If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > ORA-00001: unique constraint violated

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jun 2009
Posts: 18
ORA-00001: unique constraint violated

Hi..

I have faced an error as below:-
Code:
1 : 23000 : java.sql.BatchUpdateException: ORA-00001: unique constraint (SDS1.PK_EXP_TXT) violated
1 : 23000 : java.sql.SQLException: ORA-00001: unique constraint (SDS1.PK_EXP_TXT) violated
java.sql.BatchUpdateException: ORA-00001: unique constraint (SDS1.PK_EXP_TXT) violated
	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9119)
	at com.sunopsis.sql.SnpsQuery.executeBatch(Unknown Source)
	at com.sunopsis.dwg.dbobj.SnpExpTxt.setString(Unknown Source)
	at com.sunopsis.dwg.dbobj.SnpSession.saveText(Unknown Source)
	at com.sunopsis.dwg.dbobj.SnpSession.updateSession(Unknown Source)
	at com.sunopsis.dwg.dbobj.SnpSession.treatSessionPreTrt(Unknown Source)
	at com.sunopsis.dwg.dbobj.SnpSession.treatSession(Unknown Source)
	at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(Unknown Source)
	at com.sunopsis.dwg.cmd.DwgCommandBase.execute(Unknown Source)
	at com.sunopsis.dwg.cmd.e.i(Unknown Source)
	at com.sunopsis.dwg.cmd.g.y(Unknown Source)
	at com.sunopsis.dwg.cmd.e****n(Unknown Source)
	at java.lang.Thread****n(Thread.java:534)
After i check data in all_indexes table, i have found some old data which are belongs to 2008 and 2009. The sample as below:-
Code:
OWNER     INDEX_NAME          LAST_ANALYZED
SDS1	PK_ACTION	   31-OCT-09 07:04:49
SDS1	AK_ACTION	   31-OCT-09 07:04:49
SDS1	PK_COND	                31-OCT-09 07:04:50
SDS1	AK_COND	                31-OCT-09 07:04:50
SDS1	COND_FK1	   31-OCT-09 07:04:50
SDS1	COND_FK2	   31-OCT-09 07:04:50
Based on the error message how could i know what is the error table name and what is the duplicate unique key on the error table ?.

Please help me how to solved the problem and how could i avoid the problem ?

Please guide me ?

Thank you
baharin
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Posts: 2,296
that's not old data. oracle is showing you the last time your indexes were analyzed.
the error is very simple. you are attempting to insert a duplicate into EXP_TXT based on the columns that encompass the primary key (unique identifier).

Basically, determine what columns encompass the primary key for that table to determine what data is a duplicate. OR, have java spit out the offending insert/update statement.
__________________
- The_Duck
you can lead someone to something but they will never learn anything ...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On