ORA-00001 SQL Origin: Data Last updated 12 Oct 2026

ORA-00001: unique constraint (SCHEMA.PK_X) violated

An insert/update duplicated a value in a unique or primary key constraint.

Exact message you may see unique constraint violated
Seen on: SQL

Meaning

Common when sequences fall behind manually inserted ids or seeds run twice.

Common causes

  • Duplicate value
  • Sequence behind existing max(id)
  • Re-run seeds

⚡ Quick fix

  1. Use MERGE for upserts
  2. Advance the sequence past max(id)
  3. Handle as "already exists"

Detailed fix by platform

SQL

  1. ALTER SEQUENCE orders_seq RESTART START WITH 100001; -- Oracle 18c+

How to diagnose

  1. Constraint — Which one?
  2. Sequence — Behind the data?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1062 — MySQL ERROR 1062 (23000): Duplicate entry for key (MySQL)10622627 — SQL Server: Violation of PRIMARY KEY constraint 'x'. Cannot insert duplicate key in object 'y'. (Msg 2627) (SQL)2627ALREADY_EXISTS — API Error: Resource already exists (ALREADY_EXISTS / resource_already_exists / 409) (API)ALREADY_EXISTSDbUpdateException — DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. (.NET)DbUpdateExceptionORA-00054 — ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired (SQL)ORA-00054ORA-00904 — ORA-00904: "X": invalid identifier (SQL)ORA-00904ORA-00933 — ORA-00933: SQL command not properly ended (SQL)ORA-00933ORA-00942 — ORA-00942: table or view does not exist (SQL)ORA-00942ORA-00001

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.