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: Rename a column

Re: Rename a column

From: Dave O'Keeffe <DOKeeffe_at_n0spam.cableinet.co.uk>
Date: Tue, 21 Apr 1998 20:56:01 +0100
Message-ID: <353CF9D1.1BE0@n0spam.cableinet.co.uk>


Jurij,

thanks for the information - I've always wondered how to do that. I don't think I'll ever have the guts to run it in real life however!

Dave O'Keeffe

Jurij Modic wrote:
>
> On Mon, 20 Apr 1998 13:21:48 GMT, tim.hall_at_spam.begone (Tim Hall)
> wrote:
>
> >On Mon, 20 Apr 1998 21:00:35 +0800, "Lui Yuan Tze"
> ><ssplyt_at_pacific.net.sg> wrote:
> >
> >>Hi,
> >>How does one rename a table column ?
> >>
> >>Cheers
> >>
> >
> >You can't. You have to rename the table, then create a new table with
> >your desired new column in it and copy the data across (You can do
> >this with create table <TABLE> as select * from <OLD_TABLE>)
> >
>
> You can do it, if you are willing to take a risk of messing around
> with Oracle's fixed tables. If anything goes wrong, I'm afraid youl be
> on your own, don't rely on Oracle Support. So here it goes:
>
> Assume you want to rename column A FROM TABLE SCOTT.TEST_TABLE to B:
> 1. take a clean backup of your database;
> 2. Connect as SYS or internal;
> 3. Isue a following update:
>
> UPDATE col$ SET name = 'B'
> WHERE obj# = (SELECT obj# FROM obj$
> WHERE name = 'TEST_TABLE'
> AND owner# = (SELECT user# FROM user$
> WHERE name = 'SCOTT')
> )
> AND name = 'A';
>
> 4. Restart the database
>
> Again, you are doing this on your own risk (I've used it successfully
> a couple of times).
>
> >Tim Hall, Indus International (was TSW International)
> >tim.hall (at) iint.com
> >http://www.indusworld.com
>
> Regards,
> ============================================================
> Jurij Modic Republic of Slovenia
> jurij.modic_at_mf.sigov.mail.si Ministry of Finance
> ============================================================
> The above opinions are mine and do not represent any official
> standpoints of my employer

--
For email replys remove "n0spam." from the above address Received on Tue Apr 21 1998 - 14:56:01 CDT

Original text of this message

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