RE: ORA-00001: unique constraint (MYDB.SYS_C006557) violated

From: Mark W. Farnham <mwf_at_rsiz.com>
Date: Thu, 29 Mar 2012 11:33:02 -0400
Message-ID: <045601cd0dc1$3b09f550$b11ddff0$_at_rsiz.com>



You can assert NEITHER that two nulls are equal nor unequal. Oracle has that correct.

Are you used to using promoting some database that pretends it CAN assert inequality between nulls?

With this question following hot on the heels of the well understood trade-off of Oracle for speed and caching rather than guaranteed ordered no-skip use for sequences (for which the old solution of incrementing a column in a table is as acid as the database), I'm becoming really curious about whether you're legitimately asking question or intentionally create confusion.

Oracle's treatment and explanation of the trade-off for sequences dates to at least November 1988.
Oracle's treatment and explanation of its logic values for nulls and uniqueness of indexes is older than that.

If you're really asking questions and this was just a coincidence, that is quite a coincidence indeed.

If you ARE trying to learn the difference between some other RDBMS system and Oracle I suggest you search for a guide with the title something like "Oracle for DB2 DBAs" or similar titles, as well as reading the Oracle Concepts Guide cover to cover as a start.

Based on the first two questions I've seen from you, that will save you a ton of time if your interest is legitimate.

Yet please do not feel unwelcome on this list. That is not my intent.

Regards,

mwf

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of jose soares
Sent: Thursday, March 29, 2012 10:40 AM
To: ORACLE-L
Subject: ORA-00001: unique constraint (MYDB.SYS_C006557) violated

Hi all,

I think I have a problem with NULL values on composit indexes:

create table test(id int primary key, pia int, ua int, data date, ver int); create unique index unik on test(pia int, ua , data , ver ) insert into test values (1,37,76,null,1); insert into test values (2,37,76,null,1);

ORA-00001: unique constraint (MYDB.SYS_C006557) violated

I hope Oracle knows that no two null values are equal :-)


this one works, instead:

create table test(id int primary key, pia int, ua int, data date, ver int); create unique index unik on test(data ) insert into test values (1,37,76,null,1); insert into test values (2,37,76,null,1);

what's wrong?

j

--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Thu Mar 29 2012 - 10:33:02 CDT

Original text of this message