Re: Renaming columns?

From: Youichi Tamura <y-tamura_at_nri.co.jp>
Date: Sat, 20 Aug 1994 05:43:58 GMT
Message-ID: <CutJxB.DAJ_at_nrigw11.nri.co.jp>


From article <32tti5$dg2_at_freenet3.scri.fsu.edu>

        by howardh_at_freenet3.scri.fsu.edu

> Is there a way to rename a column in Oracle?

	No, unless you tinker with data dictionary tables (which I certainly
	would not).  I only have two alternatives.

	1. You could unload the data, drop the table, created it with a new
	column name, load the data back into it, and issue whatever grants 
	had been issued on the table.  Or, 

	2. You could:

		create table T1 
		as select ... old_col_name new_col_name, ... from T;
			(use column name alias for the new name)

		drop table T;

		rename T1 to T;

		alter table T .... ( <- define primary keys, indices, etc.)

		grant .... on T to ....

	Some people have a sql script file that automates this process; 
	I need to have a lot of trust in the reliability of such a script
	before I use one.

---
							Yoichi Tamura
							y-tamura_at_nri.co.jp
Received on Sat Aug 20 1994 - 07:43:58 CEST

Original text of this message