Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: renaming a cloumn
In article <701105d6.0112112218.6f075043_at_posting.google.com>,
watchdog_hu_at_hotmail.com says...
>
>Thomas Kyte <tkyte_at_us.oracle.com> wrote in message
>news:<9v694g02bd6_at_drn.newsguy.com>...
>> In article <3C169496.CD6C5F63_at_web.de>, Holger says...
>> >
>> >Hi,
>> >
>> >this is not correct. I think since 8.1.7 it is possible to rename columns.
>> >I have done it a few weeks ago, but can't remember the syntax.
>>>If you have installed the help you should a have a look at the parameters for
>> >"alter table modify column". I think it was "move" but I'm not sure.
>> >
>>
>> nope, you cannot rename a column. you did something else.
>>
>> you can 'move' a table, you cannot rename a column.
>>
>>
>>
>> >Hope this helps,
>> > Holger
>> >
>> >Sue Wi-Afedzi schrieb:
>> >
>> >> You can't rename a column, but you can add a new column with the new name,
>>>> (alter table add ...), populate it with the values of the first column, then
>> >> drop the first column (alter table drop column <column name>). The
>> >> database must be 8i or higher and the owner of the table cannot be SYS.
>> >>
>> >> Hope that helps.
>> >>
>> >> Sue
>> >> "Najm Hashmi" <najmh_at_videotron.ca> wrote in message
>> >> news:wtjR7.18657$2F2.1189458_at_weber.videotron.net...
>> >> > Hi All,
>>>> > What is the correct syntax to rename a column in a table using alter table
>> >> > command.
>> >> > Thanks in advance.
>> >> > Regards, Najm
>> >> >
>> >> >
>> >
>Try this if u want.
>
>sqlplus>connect sys/*******
>sqlplus>update col$ set name='NEW_COLUMN_NAME' where obj#=(select obj#
>from obj$ where name='UR_TABLE_NAME' and owner#=(select user# from
>user$ where name='UR_ACCOUNT') ) and name='OLD_COLUMN_NAME';
>sqlplus>commit;
>sqlplus>alter system flush shared_pool;
>sqlplus>desc ur_account.ur_table_name
This is the single worst piece of advice any Oracle professional could ever give to anyone, novice or expert.
Never, ever, update your data dictionary. You can and will hit unexpected ora-600's and many other nice things doing such things.
This is one of the reasons we've made the data dictionary (sys tables) really hard to query let alone update in 9i. by default, sys cannot log in and you cannot see them.
Don't do this. Period.
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Wed Dec 12 2001 - 07:51:21 CST