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: dropping a column

Re: dropping a column

From: AMARENDRA B NETTEM <nettama_at_charlie.cns.iit.edu>
Date: 1997/07/08
Message-ID: <33C28469.65EF@charlie.cns.iit.edu>#1/1

Ceri Moran wrote:
>
> Hi,
>
> I know this may seem a stupid question, but I am using Oracle 7.3 for
> NT, and I am having dificulty altering the table.
>
> I have two columns in the middle of a table, I wish to move to the
> end, I cant seem to reorder using the Navigator or SQLPLUS.
>
> I have tried removing and adding them in, but cant seem to find the
> correct SQL to allow me to do this.
>
> Please could you advise me the correct SQL for dropping a non-key
> column from a table?
>
> Thanks
>
> Ceri Moran

Hi Ceri,
The only way to move the columns to the end is to create a temp table. For example if you have a table 'tab' with columns a,b,c,d,e and wants to move columns
  b and c to the end, follow the following steps. 1.CREATE TABLE TEMP(a,d,e,b,c)
  as
  SELECT a,d,e,b,c from tab;
2. DROP TABLE TAB;
3.RENAME TEMP TO TAB; Hope this helps

-- 
  AMARENDRA B NETTEM ( http://www.iit.edu/~nettama)
  Certified Oracle DBA
  WHITTMAN-HART Inc.
  CHICAGO.
Received on Tue Jul 08 1997 - 00:00:00 CDT

Original text of this message

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