Home » RDBMS Server » Server Administration » Re: Oracle8i: Add New Column to Bet. Columns
Re: Oracle8i: Add New Column to Bet. Columns [message #374553] Mon, 18 June 2001 11:19
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi,

alter table t1 add (newcol varchar2());

would add column at the the end of the row.
Which you don't like.
As far as i know
there is no stright forward way to do this without droping the table and recreating(exp/imp)

But quick fix would be,
add the column at the end to the table.
SQL> alter table t1 add (new_col varchar2());

and thne rename the table to something else,
SQL> rename t1 to t1_actual;

and create a view with original name of the table, with what ever order of cols you want, above the table
SQL> create view t1 as
(select col1, col2, new_col, col3 from t1_actual);

now use your view t1 for your transactions

in this way you don't need to change your programs.

Bala.
Previous Topic: Difference between distinct and unique?
Next Topic: COMPLEX SQL QUERY - HELP REQUIRED
Goto Forum:
  


Current Time: Sat Jul 06 17:07:32 CDT 2024