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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Changing column name

Re: Changing column name

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 13 Sep 1999 13:06:50 -0400
Message-ID: <7y7dN9AhFPrkvagcFlkfTCYK5psT@4ax.com>

On Mon, 13 Sep 1999 14:47:02 GMT, you wrote:

>there is no way to change a column name once the table has been built.
>you have a couple different ways to handle, but none are as simple as
>renaming the column.
>
>(1) you can drop and recreate the table with the desired column names.
>This would require you to unload and reload any critical data, either
>with exp/imp or by duplicating the table before dropping (ie COPY TABLE
>to TMP_TABLE; then reloading with INSERT INTO TABLE SELECT * FROM
>TMP_TABLE;)
>
>(2) rename the existing table and create a view with the desired column
>names (CREATE VIEW TABLENAME as SELECT col1, col2, col3 newname, col4
>FROM OLDTABLENAME;)
>
>I'm not certain, but I believe I read somewhere that Oracle 8i provides
>this renaming capability.
>

no it does not.

(2) is the way to do it.

In 8i, release 8.1, you can add a new column, update it to have the old column value and then DROP the old column as option (3)

>HTH,
>Roy
>
>

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Sep 13 1999 - 12:06:50 CDT

Original text of this message

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