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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Constraints

Re: Constraints

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: 2000/07/11
Message-ID: <396B1E6E.3A72D63C@edcmail.cr.usgs.gov>#1/1

Walter,

This is redundant. And furthermore, it's not possible. You can not add a unique constraint to a column that is already defined as a primary key. For example:

SQL> create table test (id number primary key);

Table created.

SQL> alter table test add constraint id_uq unique (id)

                                      *

ERROR at line 1:
ORA-02261: such unique or primary key already exists in the table

HTH,
Brian

Walter T Rejuney wrote:
>
> Is it considered redundant to have a primary key, unique constraint and
> a not null constraint all on the same column or is it considered a good
> practice to define all three even though the primary key constraint
> effectively enforces both not-null and unique constraints?
 

-- 
========================================
Brian Peasland
Raytheons Systems at
  USGS EROS Data Center
These opinions are my own and do not
necessarily reflect the opinions of my 
company!
========================================
Received on Tue Jul 11 2000 - 00:00:00 CDT

Original text of this message

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