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: Tomm Carr <carr%tw_at_edwards.af.mil>
Date: 1997/09/03
Message-ID: <340DA2A2.3758@edwards.af.mil>#1/1

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

What issue? Everything seems to be working fine. If you want to add a not null column to a table, you add the column (which, by definition has null values), fill it with non-null values and then set it to not null (which creates the constraint). Where's the problem?

-- 
Tomm Carr
tommcatt@computer.org -- http://www.geocities.com/athens/delphi/6769
-- The Macintosh computer is like the open range;
-- In a world without fences, there are no Gates.
Received on Wed Sep 03 1997 - 00:00:00 CDT

Original text of this message

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