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

Home -> Community -> Usenet -> c.d.o.server -> Re: newbie question: how to delete a column from a table definition

Re: newbie question: how to delete a column from a table definition

From: jk <john_at_demon.co.uk>
Date: Mon, 13 Apr 1998 22:23:32 GMT
Message-ID: <892506212.28385.0.nnrp-04.c2de082b@news.demon.co.uk>


In article <35328A83.5C909F6D_at_access-laserpress.com>, "Kevin P. Fleming" <kfleming_at_access-laserpress.com> wrote:
> Except for SQL Server, which doesn't allow column modification of any
> kind without dropping the table.
>
> Jonathan Gennick wrote:
> >
> > On 10 Apr 1998 07:44:40 GMT, "Steven Cools"
> > <Steven_at_digimap.be> wrote:
> >
> > > this is a very simple question : how can I delete a column from a table
> > >definition using PL/SQL? I searched through the manual of PL/SQL but I
> > >couldn't find it. Why is it not as simple as in Informix/SQL:
> > >
> > >alter table TABLENAME
> > >drop NAME-OF-COLUMN
> >
> > I think Oracle is the only database on the face of the earth
> > that can't handle this<g>. There is no "DROP COLUMN"
> > command. You have to save the data, drop the table, recreate
> > the table, reload the data, and recreate all constraints &
> > indexes in order to remove the column.
> >
> > regards,
> >
> > Jonathan

Jonathan

No you don't have to do all that
just use

create table mynewtable as select .... from myoldtable

ie after the select just choose the columns you want.

ps if you dont want the data in your old table just put an impossible condition in the where clause.

John Received on Mon Apr 13 1998 - 17:23:32 CDT

Original text of this message

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