Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: alter table modify (column_name default ....) question
Maurice Samuels wrote:
> hi,
> i have a table that i am adding a new column to and i want to initialize the column to have a value.
> here's what i've done:
> alter table TEST_TABLE add (NEW_COLUMN varchar2(50) default 'INITIAL VALUE');
>
> this runs fine but how do i take off the default value after the column has been added?
> i've tried:
> alter table TEST_TABLE modify (NEW_COLUMN default null);
> but when i look in user_tab_columns (under the data_default column), the word NULL appears. when i insert a new row (and leave out a value for
> the new column) the value for NEW_COLUMN is null (and that is fine and the expected behavior) but i'm just wondering why the word NULL is in
> user_tab_columns when it should be blank like for other columns without defaults. the version of oracle i am using is 8.1.7.2.0.
> thanks in advance,
> -maurice
> samuels_at_seas.upenn.edu
Your solution is the correct one. The reason is that NULL is the default for table columns.
Daniel Morgan Received on Tue Jan 14 2003 - 15:17:00 CST
![]() |
![]() |