Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Primary Key/Unique Key?
Hi, All!
You can test it:
SQL> create table qq(n number primary key);
Table created.
SQL> insert into qq values(null);
insert into qq values(null)
*
ERROR at line 1:
ORA-01400: mandatory (NOT NULL) column is missing or NULL during
insert
SQL> drop table qq
2 ;
Table dropped.
SQL> create table qq(n number unique);
Table created.
SQL> insert into qq values(null);
1 row created.
SQL> insert into qq values(null);
1 row created.
SQL> select * from qq;
N
SQL> insert into qq values(1);
1 row created.
SQL> insert into qq values(1);
insert into qq values(1)
*
ERROR at line 1:
ORA-00001: unique constraint (ABC.SYS_C001691) violated
Ergo:
unique <> primary
Best regards,
Ivan
Jurry wrote:
> I don't think there's really a difference.
>
> A primary key in a relational database is always unique!
>
> Dave <none_at_nowhere.nothere.oops> schreef in artikel
> <82ip3r$cuv$1_at_lure.pipex.net>...
> > Whats the difference between making something
> > a primary key and making something a unique key.
> > From Oracles point of view that is.
> > Dave
> >
> >
> >
> >
Received on Tue Dec 07 1999 - 10:21:12 CST
![]() |
![]() |