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: Rearrange columns

Re: Rearrange columns

From: HansF <Fuzzy.Greybeard_at_gmail.com>
Date: Fri, 19 Jan 2007 15:38:01 GMT
Message-Id: <pan.2007.01.19.15.38.00.484630@gmail.com>


On Fri, 19 Jan 2007 02:14:38 -0800, MRCarver wrote:

> What is the preferred way for rearranging columns in Oracle 10g XE. I
> can't seem to find a way to do this..
>
>

The preferred way in Oracle, as in all SQL-based RDBMS, is to use the list of expressions in the SELECT statement, rather than a '*'. So

SELECT col2, col9, col1
  FROM ... instead of

SELECT *
  FROM ... If you insist on rearranging column storage, you could do something like

CREATE TABLE {new_table} (new order of columns) AS
SELECT {new order of columns}
  FROM ... DROP the original table, rename the new one, and rebuild all constraints, indexes, triggers, etc.

-- 
Hans Forbrich   (mailto: Fuzzy.GreyBeard_at_gmail.com)   
*** Feel free to correct me when I'm wrong!
*** Top posting [replies] guarantees I won't respond.
Received on Fri Jan 19 2007 - 09:38:01 CST

Original text of this message

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