How can I change the column name in a table ?
simple : you can't !!!
well, you can't directly, you'll have either to create a temporary table or to create a view on your table ...
I once heard of ways to do it by playong with the dictionnary, but I would strongly prevent people from playing with that !!
U cannot change a column name in a table once it is created.In order to do so U have to drop the column(Ver 8i) or drop the table and recreate it.
If u are using Oracle8i then u can drop the column and add a new column.
alter table emp
drop column comm;
If u are using Oracle 8 then u have to drop the table and recreate it.
In case of any help please be free to write to me at firstname.lastname@example.org
ROhit Nirkhe,Oracle DBA,OCP 8i
1. add column to the table
2. write a procedure using a cursor that would pick data from the old column and insert it in the new column.
3. set the old column to unused
4. drop old column
5. (suggestion) might want to export/import the table to eliminate frag. (if this is a large table) and rebuild indexes if the index contained the old column
Click Here to Expand Forum to Full Width