Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Constraints
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
![]() |
![]() |