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

Home -> Community -> Usenet -> c.d.o.server -> Re: Which is the fast way to add a column with a value?

Re: Which is the fast way to add a column with a value?

From: John Russell <johnrussell10_at_home.com>
Date: Sat, 10 Feb 2001 07:24:39 GMT
Message-ID: <36r98toqi791e15vtkbut95sk7obn8q2q6@4ax.com>

On Wed, 07 Feb 2001 18:23:29 GMT, 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?

I don't know if this is the absolute fastest way, but you should be able to speed up the loop above by using the FORALL command. See http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a77069/04_colls.htm#28178

John Received on Sat Feb 10 2001 - 01:24:39 CST

Original text of this message

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