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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Unique Constraint Error when Altering a Table

Re: Unique Constraint Error when Altering a Table

From: Brian Zhou <bzhouNOSPAM_at_sid.hp.com>
Date: 1997/09/03
Message-ID: <340D851A.1088255@sid.hp.com>#1/1

NCR Employee wrote:

> ALTER TABLE table_name
> ADD
> (column VARCHAR(1) DEFAULT 'Y' NOT NULL);
>
 

> ERROR at line 1:
> ORA-00001: unique constraint (.) violated.
>

We are running into the same problem as yours.

We noticed that once you add a column and make it NOT NULL by using:

    ALTER TABLE table_name ADD (newcol NUMBER);     UPDATE table_name SET newcol = 0;
    ALTER TABLE table_name MODIFY (newcol DEFAULT 0 NOT NULL);

oracle no longer consider

    ALTER TABLE table_name
    ADD (newcol2 NUMBER DEFAULT 0 NOT NULL);

an error!

Is this a known issue of oracle?

Regards,

-Brian Received on Wed Sep 03 1997 - 00:00:00 CDT

Original text of this message

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