Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to Insert a Column between existing columns?
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