Re: How to insert records by descending order of date ...

From: Alvin W. Law <alaw_at_us.oracle.com>
Date: 1995/09/05
Message-ID: <ALAW.95Sep5114237_at_ap283sun.us.oracle.com>#1/1


In article <426g3l$8h2_at_hpscit.sc.hp.com> "RAJESH V.R" <vrraj_at_india.hp.com> writes:

> I need to insert say, 1000 records from table A into table B
> by descending order of A.some_date, where some_date is a date field.
> Since I cannot use order by clause in an insert statement,
> is there any other way of doing it ?

Instead of inserting the rows in your desired order, you should write your SQL statement to retrieve the rows in your desired order. In your example, you can create an descending order index on the date column. Inserting rows in a fixed order doesn't have a whole lot of meaning in a relational database; if you use an index to retrieve the rows, they will be retrieved in the order within the index anyway.

--
 "Everything that can be said about Win95 has been said... The Win95 user
  interface is not nearly as good as the Mac.  Blah, blah.  It has all been
  said a thousand times." - Larry Ellison

 Alvin W. Law ........................................... Oracle Corporation
 Senior Technology Consultant ............... 300 Oracle Parkway, Box 659305
 Applications Design & Architecture ............... Redwood Shores, CA 94065
 Email: alaw_at_oracle.com ...... Voice: +1.415.506.8317 . Fax: +1.415.506.7294
Received on Tue Sep 05 1995 - 00:00:00 CEST

Original text of this message