Questions tagged [ora-00001]

unique constraint (string.string) violated. Cause: An UPDATE or INSERT statement attempted to insert a duplicate key. For Trusted Oracle configured in DBMS MAC mode, you may see this message if a duplicate entry exists at a different level.

unique constraint (string.string) violated

Cause:

An UPDATE or INSERT statement attempted to insert a duplicate key. For Trusted Oracle configured in DBMS MAC mode, you may see this message if a duplicate entry exists at a different level.

Solution:

You need to either:

  • remove the unique restriction
  • do not insert the key
  • determine and resolve why an already existing key is attempting to be inserted

References

49 questions
39
votes
12 answers

Java - find the first cause of an exception

I need to check if an exception is caused by some database problem. I receive an Exception and check if its cause contains the "ORA" string and return that (something like "ORA-00001"). The problem here is that the exception I receive is nested…
Averroes
  • 4,168
  • 6
  • 50
  • 63
23
votes
4 answers

Where can I find a complete list of predefined Oracle pl/SQL Exceptions?

Where can I find a full list of all predefined Oracle pl/SQL Exceptions? In this link i found this list, are there anymore? ACCESS_INTO_NULL ORA-06530 CASE_NOT_FOUND ORA-06592 COLLECTION_IS_NULL ORA-06531 CURSOR_ALREADY_OPEN…
RRUZ
  • 134,889
  • 20
  • 356
  • 483
17
votes
2 answers

Finding ghost constraint from Oracle DB

I had a constraint in a table CREATE TABLE "USERSAPPLICATIONS" ( "USERID" NUMBER NOT NULL , "APPLICATIONNAME" VARCHAR2 (30) NOT NULL , CONSTRAINT "PK_USERSAPPLICATIONS" PRIMARY KEY ("USERID","APPLICATIONNAME") ) / Two weeks ago I…
simon
  • 12,666
  • 26
  • 78
  • 113
14
votes
5 answers

How to automatically generate identity for an Oracle database through Entity framework?

I'm using Oracle provider for Entity framework (beta), and I'm facing a problem. Our tables have Id columns, which are set to be Identity in StoreGeneratedPattern. I thought that EF will automatically do "underlying works", such as create sequences,…
Delta76
  • 13,931
  • 30
  • 95
  • 128
8
votes
1 answer

What is the proper way to catch and handle ORA-00001 SQLException with JDBC?

I'm creating a simple form that stores entered data in an extremely simple Oracle database table via a Java Servlet using JDBC. That table is using the email address as a primary key. If a user submits a form multiple times with the same email…
Luke
  • 3,742
  • 4
  • 31
  • 50
7
votes
2 answers

Getting ORA-00001(unique constraint violated) when COMMITing?

We're getting a ORA-00001 (unique constraint violated) in a batch job. However, the error occurs when a COMMIT is issued, not at the time the offending record is inserted. Questions: How come that the unique constraint is checked at COMMIT? (Are…
Thorsten
  • 12,921
  • 17
  • 60
  • 79
6
votes
1 answer

Force Hibernate to issue DELETEs prior to INSERTs to avoid unique constraint violations?

Background: http://jeffkemponoracle.com/2011/03/11/handling-unique-constraint-violations-by-hibernate Our table is: BOND_PAYMENTS (BOND_PAYMENT_ID, BOND_NUMBER, PAYMENT_ID) There is a Primary key constraint on BOND_PAYMENT_ID, and a Unique…
Jeffrey Kemp
  • 59,135
  • 14
  • 106
  • 158
5
votes
4 answers

Rails: Oracle constraint violation

I'm doing maintenance work on a Rails site that I inherited; it's driven by an Oracle database, and I've got access to both development and production installations of the site (each with its own Oracle DB). I'm running into an Oracle error when…
justinbach
  • 1,945
  • 26
  • 44
5
votes
2 answers

ora-00933:SQL command not properly ended

I have the following code: begin for i in 1..2 loop insert into dba_xy.despatch select desp_id_seq.nextval, dbms_random.string('U',5), trunc(dbms_random.value(0000,9999)), prod_id from dba_xy.product prod_name from…
taksIV
  • 121
  • 2
  • 3
  • 8
4
votes
2 answers

Insert or Update using Oracle and PL/SQL

I have a PL/SQL function that performs an update/insert on an Oracle database that maintains a target total and returns the difference between the existing value and the new value. Here is the code I have so far: FUNCTION calcTargetTotal(accountId…
Shane
  • 41
  • 1
  • 2
4
votes
1 answer

How to find the offending insertion from a BatchUpdateException?

When I have a BatchUpdateException as the result of a unique constraint violation is there a way for me to determine which record in the batch insert is in violation? For example let's say I'm performing a batch insert by calling…
James Adams
  • 8,448
  • 21
  • 89
  • 148
3
votes
3 answers

Identical Oracle db setups: exception on just one of them

edit: Look to the end of this question for what caused the error and how I found out. I have a very strange exception thrown on me from Hibernate when I run an app that does batch inserts of data into an oracle database. The error comes from the…
oligofren
  • 20,744
  • 16
  • 93
  • 180
3
votes
2 answers

HOW TO SElect line number in TextBox Multiline

I have large text in System.Windows.Forms.TextBox control in my form (winforms), vs 2008. I want find a text, and select the line number where I've found that text. Sample, I have fat big text, and I find "ERROR en línea", and I want select the line…
Alhambra Eidos
  • 1,515
  • 4
  • 21
  • 31
3
votes
2 answers

Oracle - UPSERT with update not executed for unmodified values

I'm using following update or insert Oracle statement at the moment: BEGIN UPDATE DSMS SET SURNAME = :SURNAME WHERE DSM = :DSM; IF (SQL%ROWCOUNT = 0) THEN INSERT INTO DSMS (DSM, SURNAME) VALUES (:DSM, :SURNAME); END…
Buthrakaur
  • 1,821
  • 3
  • 23
  • 35
3
votes
1 answer

Oracle DML errors lacking detail

I am catching errors from a bulk insert operation like this: begin --bulk insert forall i in v_data.first .. v_data.last save exceptions insert into my_filter_table values v_data (i); commit; exception -- catch and print…
FrustratedWithFormsDesigner
  • 26,726
  • 31
  • 139
  • 202
1
2 3 4