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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Changing column name in oracle?

Re: Changing column name in oracle?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: 2000/06/13
Message-ID: <394621BD.5ADA@yahoo.com>#1/1

Sunny wrote:
>
> Ok is it possible to drop a column from an Oracle table.
>
> Jonathan Gennick <jonathan_at_gennick.com> wrote in message
> news:us1bkscdbc93pnqtkt2khjli353sgi74ip_at_4ax.com...
> > On Mon, 12 Jun 2000 15:34:33 -0700, "Sunny"
> > <sunnyb_at_vendtek.bc.ca> wrote:
> >
> > >is it possible to change a table's column name
> >
> > No. What I've done in the past when i've needed to change a
> > column name without recreating the table is:
> >
> > 1. Create new column with the name I want.
> > 2. Create insert & update triggers to keep the new column in
> > sync with the one it is replacing.
> > 3. Execute an UPDATE statement to initialize the new column
> > with data from the existing column.
> > 4. Tell programmers to use the new column.
> > 5. Eventually, when I get a window for downtime, rebuild the
> > table.
> >
> > Of course, if you can just rebuild the table to start with,
> > that's easier and probably less risky.
> >
> > Jonathan
> >
> > _____________________________________________________
> > jonathan_at_gennick.com
> > http://gennick.com
> > Brighten the Corner Where You Are

Yes - in 8i upwards, check in ALTER TABLE

In terms of your original post, some options are:

  1. rename the table and create a view with the table name and new column name
  2. very unsupported way - hack into SYS.COL$
-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk

We are born naked, wet and hungry...then things get worse
Received on Tue Jun 13 2000 - 00:00:00 CDT

Original text of this message

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