Re: Can we remove a column from a table??

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: 2000/01/31
Message-ID: <389574C2.637D_at_yahoo.com>#1/1


pberetta_at_my-deja.com wrote:
>
> Peter,
> Unless you are using Oracle 8i, you cannot remove a column from a
> table. What you must do is something like this:
>
> RENAME old_name to new_name;
> CREATE TABLE old_name AS SELECT col1, col2 FROM new_name;
> DROP new_name;
>
> Not quite as simple as an ALTER TABLE, but it gets the job done.
> Regards,
> Paul
>
> In article <38952DF3.9B9654EC_at_hmc.com.tw>,
> peter <misybh_at_hmc.com.tw> wrote:
> > hi..
> > I have a table named 'test' which has 3 columns..
> > Can I remove one column????
> >
> > we all know that we can use SQL command to alter a table
> > but it seems that we only add or modify a column ..
> > How can we remove a column from a table???
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

A view is often an easier solution (since constraints etc etc etc) are all preserved.

You can also do some nasty hacks to SYS.COL$ but I won't go into that one...

HTH

-- 
===========================================
Connor McDonald
"These views mine, no-one elses etc etc"
connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue."
Received on Mon Jan 31 2000 - 00:00:00 CET

Original text of this message