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: How to Insert a Column between existing columns?

Re: How to Insert a Column between existing columns?

From: BD <robert.drea_at_gmail.com>
Date: 8 Jan 2007 19:40:26 -0800
Message-ID: <1168314026.513916.152070@42g2000cwt.googlegroups.com>

sealo wrote:
> Hello,
> I want to insert a new column in the specified position to a exsited
> table. But all the default operation of adding column is to append the
> new column at the tail.
>
> There seems no SQL statement for my purpose.
>
> For example:
> The existing table have columns
> ID NUMBER(10)
> AGE NUMBER(10)
>
> I want to insert a new column NAME (VARCHAR2 (30)) between ID and AGE.
> Then, the expectation should like this.
>
> ID NUMBER(10)
> NAME VARCHAR2 (30)
> AGE NUMBER(10)
>

1- drop all constraints and indexes for current table
2- rename current table (to _OLD)
3- create new version of table with the correct structure
4- insert all rows from current table into new table
5- recreate indexes and reapply constraints.
6- drop old (renamed) table


>
> Is there some method for this ?
Received on Mon Jan 08 2007 - 21:40:26 CST

Original text of this message

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