Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to reorder fields in a table
In article <3B55E6A0.CE081CB8_at_hotmail.com>, ewarmoth says...
>
>When I alter a table to add new fields, the fields are put at the end of
>the table. Is there a way to add a field between two existing ones? Or
>am I stuck with them at the end?
>
>If I were to drop the table and re-create it, I would lose the data,
>right?
>
>Thanks very much,
>Emily
This is what views are for.
alter table t add some_column_that_should_be_in_the_middle int;
rename t to t_table;
create view t as select c1, some_column_that_should_be_in_the_middle , c2
from t_table;
do the grants on t again and your applications will never know they are using a view and not a table.
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Mon Jul 23 2001 - 20:23:57 CDT
![]() |
![]() |