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: Insert from another table...Create with ORDER BY

Re: Insert from another table...Create with ORDER BY

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: 1997/08/08
Message-ID: <01bca432$0f0ef5d0$294b989e@WORKSTATION>#1/1

Your suggestion will not work if you are using parallel query option and the create table goes parallel.
One possible solution is to create an index on the required column then force its use via a hint:

	create as 
	select /*+ index(tab, ind) */
	from ....


Eric & Carole Kamradt <kamradt_at_inconnect.com> wrote in article <33EB0D10.CE57AF05_at_inconnect.com>...
> A small trick I just figured out.
> You don't seem to be able to use the ORDER BY clause
> in a CREATE TABLE x AS SELECT ...
> or in a INSERT INTO TABLE x SELECT ...
> but you can use a GROUP BY
> so if you use a set of columns that is unique like (txnum, txtotal,
> counter_field)
> then you can say
> CREATE TABLE x
> AS
> SELECT *
> FROM sourceTable
> GROUP BY txnum, txtotal, counter_field;
> or
> INSERT INTO x
> SELECT *
> FROM sourceTable
> GROUP BY txnum, txtotal, counter_field;
>
> see if that doesn't work for you
>
> Good Luck
> Eric Kamradt
>
Received on Fri Aug 08 1997 - 00:00:00 CDT

Original text of this message

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