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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Q-Sort for PL/SQL Tables

Re: Q-Sort for PL/SQL Tables

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Tue, 2 Feb 1999 20:45:19 -0000
Message-ID: <917988538.20185.0.nnrp-07.9e984b29@news.demon.co.uk>


You probably don't need one -
Off the top of my head, and making it up as I go along:

create a function that takes an integer as input, and returns a value from your table, and a function returning your_table.count

Create a table holding a large number of rows

Select rownum, function1(rownum) sorted_table_value from created_table where rownum <=

    (select count_function() from dual); order by 1;

Something like this will return your table in sorted order, but you'll have to refine it a bit, watching out especially for gaps in the pl/sql table (your_table.exists) to eliminate them from the output efficiently.

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

Charles Arcudi wrote in message <36B723AE.47DF54C6_at_eli.net>...
>Has anybody written a q-sort for PL/SQL tables? Odd that Oracle doesn't
>incorporate some kind of sort routine for these things.
>
Received on Tue Feb 02 1999 - 14:45:19 CST

Original text of this message

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