Re: Q: How to rename columns?
Date: 1996/06/04
Message-ID: <31B4C71A.2682_at_thomtech.com>#1/1
Jason Wells wrote:
>
> Ken Johnson wrote:
> >
> > There is a way to rename users and columns (tables too but why), but its
> > unsupported, undocumented, evil, fattening, etc. It uses the USER$, TABLE$, & COL$
> > tables. You can check look in the Oracle FAQ at:
> > ftp://ftp.bf.mit.edu.au/pub/Oracle/FAQ/orafaqwww.zip for more details.
> >
> > But there is no nice, clean, supported way to rename Users or Columns. (You can
> > rename tables with 'RENAME oldname TO newname')
> >
> > Ken Johnson
>
> Ken made a minor typo. The FAQ is at:
> ftp://ftp.bf.rmit.edu.au/pub/Oracle/FAQ/orafaqwww.zip
> ^
> --
>
Following is one way to change the columns name: 1. copy the table into a temporary table, including data (use: CREATE TABLE t_xx AS SELECT * FROM xx).
2. Drop the table (DROP TABLE xx). 3. Re-create the table with the new column name. 4. Insert data into this table from the temporary table created in step 1above.
5. Drop the temporary table.
CAUTION: You may not want to attempt this if you have large amount of data in the table.
I know this is a roundabout way of changing a column name, but it works! Received on Tue Jun 04 1996 - 00:00:00 CEST