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: Very strange... PK enabled with null values in it!

Re: Very strange... PK enabled with null values in it!

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 9 Dec 1999 09:53:08 +0100
Message-ID: <82nve0$145ll$1@oceanite.cybercable.fr>


In which versions do you have this behavior?

I try in 7.3.4 and it works correctly:

v734> create table t (col1 number, col2 number);
v734> insert into t values (1,1);
v734> insert into t values (2,null);
v734> alter table t add primary key (col1, col2);
alter table t add primary key (col1, col2)
                                     *

ERROR at line 1:
ORA-01449: column contains NULL values; cannot alter to NOT NULL

--
Regards
Michel

Erwin Dondorp <erwindon_at_wxs.nl> a écrit dans le message : 384E9C85.76EFE125_at_wxs.nl...
> aquabubble wrote:
> > I was wondering if anyone else had seen this kind of thing before. This
> > should be impossible, so how can I have a primary key enabled with null
> > values in its column?
> >
> > Also, we've just seen another table with a composite primary key with
> > null values in its second column.
> >
> > In both of these cases, the pk is enabled and the index is valid
> > (whatever use that info is).
>
> In some versions of Oracle this effect can/could be reached by adding
> the primary
> key after the record were already present.
> ALTER TABLE ... ADD PRIMARY KEY
> did check for duplicate records during the index building but the NOT
> NULL constraint
> that was also added was never checked.
>
> --
> Erwin Dondorp
> <http://www.dondorp.com/>
Received on Thu Dec 09 1999 - 02:53:08 CST

Original text of this message

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