Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Unique Constraint Error when Altering a Table
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
![]() |
![]() |