Re: Changing Column names

From: Chuck Hamilton <chuckh_at_dvol.com>
Date: 1996/06/13
Message-ID: <31c03b0d.11887088_at_n5.gbso.net>#1/1


ranand_at_osf1.gmu.edu (RISHI ANAND) wrote:

>Hi everyone,
>
>I just had a question regarding changing the headings of the column
>names in oracle SQL.
>For example, if we have table that has different columns with headings
>like NAME, ADDRESS, ID, etc..and I want to change the 'NAME' field to
>something else like 'EMP_NAME', then how would I go about doing that.
>Please let me know.
>Thanks.

If all you want to do is change the name in query headings, do something like this:

select

	name	emp_name,
	address	addr,
from
	my_table;


If you want to change the name of the column, you have to recreate the table.

create table new_emp as select name emp_name, address from emp; drop table emp;
rename new_emp to emp;

Before dropping the original table, make sure you recreate all indexes and constraints on the new table.

>--
>**RISHI**
>
 

>*********Never tell a lie unless it is absolutely convenient.**********

Bill Clinton's motto. :)

(How do you tell with Bill Clinton is lying? .... When his lips are moving.)

--
Chuck Hamilton
chuckh_at_dvol.com

Never share a foxhole with anyone braver than yourself!
Received on Thu Jun 13 1996 - 00:00:00 CEST

Original text of this message