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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: order of rows when selecting from table of

Re: order of rows when selecting from table of

From: Joseph S. Testa <jtesta_at_dmc-it.com>
Date: Fri, 16 Apr 2004 05:06:42 -0400
Message-ID: <407FA222.5010303@dmc-it.com>


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_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Fri Apr 16 2004 - 04:03:46 CDT

Original text of this message

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