Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to change column names?

Re: How to change column names?

From: Pavel Polcar <pavel.polcar_at_berit.cz>
Date: 1998/09/22
Message-ID: <6u7hvo$nej$1@cbu.pvtnet.cz>#1/1

Hi there,
I'm not sure if it wasn't me who posted that info about directly writing to tables like col$,... In any case, I have got such a script in case someone is interested, but I warn you that TO USE IT IS AT YOUR OWN RISK. After using the script, the database must be restarted, anyway, to get the data dictionary definitions into memory again (flushing the shared pool might be sufficient, haven't tried it yet).

rem Script to change column name
rem
rem Activation: sqlplus sys/<sys_password> @chcname$ rem
rem All names must be entered in capital letters !!!! rem
rem USE ONLY AT YOUR OWN RISK
update col$ set name='&new_name'
where name='&old_name'
and obj#=(select obj# from obj$

          where name='&table_name'
            and owner#=(select user# from user$
                         where name='&user'));

Regards,

--
Pavel Polcar
Winnie Liu wrote in message <6u7746$7s_at_dfw-ixnews5.ix.netcom.com>...

>No, alter table cannot change a column's name. I remember someone post on
>the group saying that you can change a data dictionary view (ts$ ?), but I
>never brave enough to try!
>
>Winnie
>
>badstreetboy_at_my-dejanews.com wrote in message
><6u6t6v$a2b$1_at_nnrp1.dejanews.com>...
>>I know 'alter table' can add column or change datatype of a column. But
can
>>it change column name?
>>
>>Thanks..
>>
>>
>>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
>
Received on Tue Sep 22 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US