Re: order of rows when selecting from table of

  • From: "Joseph S. Testa" <jtesta@xxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Fri, 16 Apr 2004 05:06:42 -0400

Edgar, oracle does not guarantee that data is returned ordered unless 
you use an order by clause(at least from what i remember).  will you get 
data back in what seems ordered with certain syntax, absolutely, since 
there are implicit sorts, but you're not supposed to rely on it.

joe


Edgar Chupit wrote:

>Hello oracle-l,
>
>I have custom type that is "table of numbers", does Oracle guaranties
>that when I use select from table(var) I will receive result in order
>of indexes? If not, than how do I get not only the values but also
>indexes of elements?
>
>Thank you in advance!
>
>Code snippet below:
>
>SQL> create type num as table of integer
>  2  /
>
>Type created.
>
>SQL> var result refcursor;
>SQL> declare 
>  2    n num := num();   
>  3  begin
>  4    n.extend(10);
>  5    for i in 1 .. 10 loop
>  6        n(i) := i;
>  7    end loop;
>  8    
>  9    open :result for select column_value from table ( n );
> 10  end;
> 11  /
>
>PL/SQL procedure successfully completed.
>
>SQL> print result;
>
>COLUMN_VALUE
>------------
>           1
>           2
>           3
>           4
>           5
>           6
>           7
>           8
>           9
>          10
>
>10 rows selected.
>
>  
>

-- 
Joseph S Testa
Chief Technology Officer
Data Management Consulting
614-791-9000
It's all about the "CACHE"

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: