Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: ORA-00001: unique constraint violated

Re: ORA-00001: unique constraint violated

From: Mohamad SALEH <msaleh_at_orsys.fr>
Date: 2000/05/20
Message-ID: <39266797.198DD70D@orsys.fr>#1/1

Job a écrit :

> Mohamad SALEH wrote:
> >
> > screwbai_at_my-deja.com a écrit :
> >
> > > I figure out this problem. One of the column had a NULL in it. And NULLs
> > > are not allowed in a unique index.
> >
> > Not true as much as Oracle is engaged! I knew it but I have done the
> > following on Oracle 8.1.6
> >
> > create table essai (a integer, b integer, c char(1));
> > create unique index uind on essai(a,b);
> > insert into essai values(null, null, 'a');
> > insert into essai values (null, null, 'b');
> > insert into essai values(1, null, 'c');
> >
> > All of these instructions completed with no problem.
> >
>
> Interesting - but what happens when you try
> to select from this table? I would wager
> that you can't select those rows by a and/or b.

Right, except if you use the IS NULL clause. To be complete, you cannot insert now
a line like this (1, null, 'd'); it would violate the unique constraint.

--
Mohamad
Received on Sat May 20 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US