rename a column [message #374311] |
Tue, 05 June 2001 08:06 |
theresia
Messages: 9 Registered: May 2001
|
Junior Member |
|
|
is it possible to rename a column in oracle?
if so how is it done?
regards
sini
|
|
|
Re: rename a column [message #374314 is a reply to message #374311] |
Tue, 05 June 2001 08:17 |
Cindy
Messages: 88 Registered: November 1999
|
Member |
|
|
Yes.
Try this:
SQL> select 'YOUR_COLUNM' NEW_NAME from dual;
NEW_NAME
-----------
YOUR_COLUNM
OR this:
SQL> select 'YOUR_COLUNM' "NEW_NAME" from dual;
NEW_NAME
-----------
YOUR_COLUNM
|
|
|
Re: rename a column [message #374326 is a reply to message #374311] |
Tue, 05 June 2001 16:34 |
Andrew again...
Messages: 270 Registered: July 2000
|
Senior Member |
|
|
In Oracle 8.1.5 or later you can drop a column, so
1.) Alter table ABC add column (NEW_COL...)
2.) update ABC set NEW_COL = OLD_COL;
-- If not null...
3.) alter table ABC modify (NEW_COL not null);
4.) alter table ABC drop column OLD_COL;
|
|
|