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

Re: Renaming a column

From: Bertalan GOMBOS <gombos_at_finit.hu>
Date: Mon, 07 Sep 1998 13:13:09 +0200
Message-ID: <35F3BFC5.41A27D58@finit.hu>


Jonathan Gennick wrote:
>
> On Sat, 22 Aug 1998 22:36:28 -0500, Lak Nadella
> <lak_at_more.net> wrote:
>
> >Could someone give me pointers as to how I can rename a column in a
> >table without dropping the table and recreating it?
>
> I wish I could, oh i wish I could, but I cannot. You have to
> drop the table and recreate it.
>
> There is actually one alternative if you can stand to do it:
>
> 1. create a new column with the desired name.
>
> 2. issue an update statement to set the new column to the
> value from the old column.
>
> 3. make the old column nullable.
>
> Now you can use the new column in all your programs,
> queries, etc. THe old column will hang around forever, but
> you can ignore it. It's a bit untidy.

It's not a perfect solution because you must modify all your INSERT INTO <table> VALUES ( ... ) commands in your PL/SQL procedures...

					Bye:
						Bert
-- 
                                           :
 ----.----,  ------------------------------:----------------------------
   --;----"-----,  ,--------,  ,--------,  |     Bertalan Gombos
     |          |  ;--------'  |           |    software engineer
  ---|----------'  `--------   |           |  bgombos_at_freemail.c3.hu
`----'  ---------------------------------  `------------------------ '98
Received on Mon Sep 07 1998 - 06:13:09 CDT

Original text of this message

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