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: Walter T Rejuney <BlueSax_at_Unforgetable.com>
Date: 2000/07/11
Message-ID: <396B32D2.EA6FA429@Unforgetable.com>#1/1

Brian Peasland wrote:
>
> 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?
>

That answers my question. Thanks. Probably could have saved myself some time by try it for myself. Received on Tue Jul 11 2000 - 00:00:00 CDT

Original text of this message

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