Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Why does sqlplus "select" produce different order of data?
David Shi wrote:
>
> (please also forward your message to dshi_at_magpage.com, thanks a lot)
>
> Sorry about posting several questions at the same time, sometimes it's
> so difficult to get help from Oracle technical support.
>
> I noticed when I do a select, each time I got different order of data,
> is this a Unix buffer problem or something else?
>
> Oracle version 7.3.3, OS: Solaris 2.5.1 on a SUN 4000.
>
> What I did is (under Unix command line):
>
> echo "select * from table;" | sqlplus -s / | more
>
> The first time the output may be like (just as an example):
>
> 1111
> 2222
> 3333
>
> the second time maybe
>
> 2222
> 3333
> 1111
>
> Thanks for your help.
>
> David
Hi,
it's no problem, it's normal. Your select statement returns a set of records. Sets by default aren't sorted. So every time you launch your statement you'll get the records the way oracle finds them. To get the record in a distinct order you've got to add a 'ORDER BY'-clause.
-- Regards Matthias Gresz :-)Received on Thu Dec 04 1997 - 00:00:00 CST