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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Order of columns within a table

Re: Order of columns within a table

From: Bob Fazio <rfazio_at_home.com.nospam>
Date: 2000/06/06
Message-ID: <_XZ_4.234891$Tn4.2125337@news1.rdc2.pa.home.com>#1/1

create table tmp as select 1,2,3 from old;

drop table old;

create table old as select 3,2,1 from tmp;

--
Robert Fazio, Oracle DBA
rfazio_at_home.com
remove nospam from reply address
http://24.8.218.197/
"JD" <mail_at_mail.com> wrote in message
news:keW_4.156035$MB.2893248_at_news6.giganews.com...

> I created the temp table, but I'm not sure how to change the order. I'm
very
> new to Oracle and sql, so an example would help me out a lot. Let's say I
> have 3 columns in the table, columns1,2 & 3 and I would like them set up
as
> columns3,2 & 1 when I create the new table. Is this done in the second
> CREATE TABLE statement? Any help would be appreciated.
>
> Regards,
> Jeff
>
> Brian Peasland <peasland_at_edcmail.cr.usgs.gov> wrote in message
> news:393BA5BE.279FA233_at_edcmail.cr.usgs.gov...
> > In relational database theory, rows and columns have no order for a
> > table when they are stored. In practice, this is not true as you have
> > found out. But one's applications should stick to this theory and not
> > rely on the stored order of things.
> >
> > Anyway, you can copy the table, drop the original, and copy back if you
> > want to change the order:
> > CREATE TABLE temp_table AS SELECT * FROM orig_table;
> > DROP orig_table;
> > CREATE TABLE orig_table AS SELECT * FROM temp_table;
> > You'll also have to recreate indexes and constraints.
> >
> > HTH,
> > Brian
> >
> >
> > JD wrote:
> > >
> > > I am using 7.3.4 and would like to be able to change the order of the
colums
> > > (there are about 25) in a table. A front-end program I use queries the
> > > database and displays the columns in the same order as they are in the
> > > schema manager. I can change the order of the columns after I run the
query,
> > > but it would be nice to re-arrange them so that I could put the more
usefule
> > > information towards the top. Thanks for any help.
> >
> > --
> > ========================================
> > Brian Peasland
> > Raytheons Systems at
> > USGS EROS Data Center
> > These opinions are my own and do not
> > necessarily reflect the opinions of my
> > company!
> > ========================================
>
>
Received on Tue Jun 06 2000 - 00:00:00 CDT

Original text of this message

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