Re: add a new column into the middle of an existing table

From: Bill Garcia <garcia.wj_at_verizon.net>
Date: Thu, 02 May 2002 03:09:00 GMT
Message-ID: <g52A8.28157$iJ.10713_at_nwrddc02.gnilink.net>


I like having the column where I want it expescially if it exists that way in another database instance.

rename old_table to old_table_bak;

copy from user/password_at_sid --
to user/password_at_sid --
create old_table --
using --
select "column list with new column in order you want" -- from old_table_bak;

Of course you will lose the indexes and/or constraints on the table. So, they will have to be recreated.

Bill Garcia
Tampa Florida

"lei wang" <leiwang_q_at_hotmail.com> wrote in message news:af074b9c.0204301247.65da02f9_at_posting.google.com...
> Is there an easy way to add a new column into the middle of an
> existing table? Seems to me that you have to create a new table and
> copies data from the old table. <Alter table add column> statement
> will only adds columns at the end of an existing table.
>
> I am using Oracle 8.1.7 EE on Solaris 2.7.
>
> Thanks.
Received on Thu May 02 2002 - 05:09:00 CEST

Original text of this message