473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Unique Constraint Violation

Why Unique Constraint Violation Takes Place In Oracle? How This Problen Can Be Solved?
Dec 27 '07 #1
3 4290
amitpatel66
2,367 Expert 2GB
Why Unique Constraint Violation Takes Place In Oracle? How This Problen Can Be Solved?
Hi Trinanjan,

Welcome to TSDN!!

Please make sure you follow POSTING GUIDELINES every time you post in this forum

Thanks
MODERATOR
Dec 27 '07 #2
amitpatel66
2,367 Expert 2GB
Why Unique Constraint Violation Takes Place In Oracle? How This Problen Can Be Solved?
Unique Constraint violation takes place when you try to insert a same value in a particular column that already exists.

Check this:

Expand|Select|Wrap|Line Numbers
  1. SQL> create table abcd(a NUMBER UNIQUE);
  2.  
  3. Table created.
  4.  
  5. SQL> insert into abcd values(1);
  6.  
  7. 1 row created.
  8.  
  9. SQL> /
  10. insert into abcd values(1)
  11. *
  12. ERROR at line 1:
  13. ORA-00001: unique constraint (APPS.SYS_C00157910) violated
  14.  
  15.  
  16. SQL> ed
  17. Wrote file afiedt.buf
  18.  
  19.   1* insert into abcd values(NULL)
  20. SQL> /
  21.  
  22. 1 row created.
  23.  
  24. SQL> /
  25.  
  26. 1 row created.
  27.  
  28. SQL> /
  29.  
  30. 1 row created.
  31.  
  32. SQL> 
  33.  
  34.  
Any number of NULLS can be inserted but not the same value.
Dec 27 '07 #3
debasisdas
8,127 Expert 4TB
Why Unique Constraint Violation Takes Place In Oracle? How This Problen Can Be Solved?
It occurs to maintain data integrity .
To solve this u need to check for existance of data in a unique / Primay key field before inserting or updating the records.
Dec 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

26
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
5
by: aj | last post by:
DB2 WSE 8.1 FP5 Red Hat AS 2.1 What is the difference between adding a unique constraint like: ALTER TABLE <SCHEMA>.<TABLE> ADD CONSTRAINT CC1131378283225 UNIQUE ( <COL1>) ; and adding a...
7
by: Brian Keating | last post by:
Hi there, Is it possible to add a unique constraint on two columns in a table, so that the constraint is a composite of the two? i.e. these two columns together should be unique...? i.e....
2
by: D. Dante Lorenso | last post by:
I'm trying to build a table that will store a history of records by enumerating the records. I want the newest record to always be number ZERO, so I created a trigger on my table to handle the...
10
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
10
by: Phil Latio | last post by:
I am inserting data into user table which contains 5 fields, sounds simple enough normally but 2 of the fields are designated as UNIQUE. If someone does enter a value which already exists, how do I...
2
by: nehaneha | last post by:
Violation of UNIQUE KEY constraint 'IX_User'. Cannot insert duplicate key in object 'dbo.User'.
2
by: rorajoey | last post by:
Violation of UNIQUE KEY constraint 'IX_surveyQuestions'. Cannot insert duplicate key in object 'dbo.surveyQuestions'. This might seem like a simple matter of trying to insert a row with ID=20 when...
1
by: crichard1983 | last post by:
I'm using a Unique Key constraint for the first time, and I think I may not be understanding something correctly. I have a table with a Primary key (media_format_id) that is auto-increment. Then I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.