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: Oracle Help: Changing Column Names

Re: Oracle Help: Changing Column Names

From: N Prabhakar <prabhs_at_po.pacific.net.sg>
Date: 1997/01/25
Message-ID: <5cc8k1$n4m@newton.pacific.net.sg>#1/1

jmessi1_at_cs.umbc.edu (john messina) wrote:
>
>Hello,
>
> I'm currently looking for a method to change column
>names in a table without effecting the data already in the
>table. I'm currently using Oracle version 7 and I'm stumped.
>
> I've tried using Alter Table, but altering a
>column name does not appear to be an option (changing
>datatypes, constraints, etc. yes, column names no).
>
> I've also tried duplicating the table, copying
>over the data and then droping the original table.
>Unfortunately, I can not drop the original table since
>I have several tables who have foreign keys which originate
>in the table I'm currrently trying to drop.
>

Hi there,

  1. Export the current table <current> without data.
  2. Rename the current table <current> to <old>
  3. Create a new table similar to current, with the correct column name
  4. rename the new table to current.
  5. Insert all the rows from old to current.
  6. IMport the exported file (step 1). It will create all foreign constraints.

The above steps should work. I have not personally tried the steps, But I have a feeling that it should work. In case if it works, pls let me know,

Regards

N.Prabhakar Received on Sat Jan 25 1997 - 00:00:00 CST

Original text of this message

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