Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Which is the fast way to add a column with a value?
You can use use ALTER TABLE tab ADD (new_column char(1) default ('N'));. We did this for a table which had 10 million records in the table (I dont know the size of the table). It took us about ten minutes or so. Give a try and see.
In article <95s3qj$rbp$1_at_nnrp1.deja.com>,
Luis Santos <lsantos_at_pobox.com> wrote:
> Hi,
>
> We have to add a column to a partitioned table. The table is over
> 12G in size, divided in 12 partiotion, of similar value (1G).
>
> The column must contain the value 'N' on it.
>
> We have limited rollback space.
>
> If we use a PL/SQL similiar to
>
> for reg in (select rowid from tab) loop
> update tab set new_column-'N' where rowid=reg.rowid
> (commit at each 20000 lines)
> end loop;
>
> the PL runs for days...
>
> Can we use ALTER TABLE tab ADD new_column char(1) default 'N'?
>
> Will this use rollback segment, as it is a DDL command?
>
> --
> Luis Santos
> Oracle DBA
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
Received on Wed Feb 07 2001 - 12:51:12 CST