Adding new column at specific position
PandeeshMay 15 2011 — edited May 15 2011Hi,
I am creating a new table:
Create table item_test(id Number(8), item_desc varchar2(48))
Now i want to add one more column price as the second column in between id and item_desc columns..
if i execut*e*
alter table item_test add price Number(8)
The price filed will be added at the end.
1)But i understand that in relational databases the order of the columns are not vital..however we can select in the order in which want by using the select statement..
2) Another approach i read is,CTAS(Create Table As Select)
a)Add the column as usual..
b) create table item_test_temp as ( select id,price,item_desc from item_test)
c) Then drop the original table
d)then again create the original table again from the temp table using CTAS.
Is there any other efficient way to achieve this?
Thanks