Re: Order by in subquery

From: Eric Pierce <sac50216_at_saclink1.csus.edu>
Date: 21 Dec 1994 02:54:41 GMT
Message-ID: <3d85dh$kbe_at_news.csus.edu>


Alayne McGregor (mcgregoa_at_cognos.COM) wrote:
: In Oracle 7.0, it is not allowed to use an order by clause in a subquery.
: I would like to do this in conjunction with a select into in order to
: create a table with the result of this subquery (that contains the order by).
 

: Can someone suggest a workaround?
 

: --
: Alayne McGregor
: mcgregoa_at_cognos.com

Not sure this is what you might have meant:

	If the "table" you are creating is outside the database 
	system, then just capture it in a text file using:

		SQL> spool listfile
		SQL> /* other slightly silly format settings... */

	The records returned by the main part of the query can
	simply be sorted with the "order by" clause. 

	A subquery generally is used to coordinate a join in an 
	update, or to limit the rows returned by a "select" statement 
	main table.

If you are doing an INSERT, then ordering is not relevant until the data is in the receiving table, then you deal with it by indexing, etc. at that point.

Your reference to "select into" sounds like SQL*Forms, but you can't create tables per se there.

Did I miss your main problem? What is it you want sorted? Why are you creating the second table?

Good luck,

EP

ps, if any of this matters, email me as I only get into this

    USENET group every once in a while.

PierceED_at_csus.edu Received on Wed Dec 21 1994 - 03:54:41 CET

Original text of this message