Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Rearrange columns
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