Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to change column names?
this is definitely possible. i have a similar script and have used it several times. it is UNSUPPORTED and you will have to bounce the instance to see the change, but it beats the hell out of copying the whole table.
i don't have my script at my fingertips to compare it to Pavel's, but i can dig it up and post it if you like. i am not sure of the original author as i pulled it off a web site long ago and have forgotten exactly where.
Bill.
Pavel Polcar <pavel.polcar_at_berit.cz> wrote in article
<6u7hvo$nej$1_at_cbu.pvtnet.cz>...
> 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
Received on Wed Sep 23 1998 - 00:00:00 CDT