Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: OR and sequence of results
I think the responses to this thread were very good. And I want to add one more item. There is nothing to fix for this. You are assuming that the order of the rows is significant even though you have not specified an ORDER BY clause. In relational database theory, there is no guarantee on the order of columns or rows. Just because the rows are returned in a different order does not mean anything is "wrong". In fact, everything is right. If you require the rows to be returned in a specific order, you'll have to use the ORDER BY clause.
HTH,
Brian
Jonathan Lewis wrote:
>
> It is not a feature, it is a side effect
> of whichever execution path Oracle
> chooses to take. It is highly dependent
> on versions, choice of optimiser, existence
> of indexes and size of data.
>
> Don't depend on it.
>
> --
>
> Jonathan Lewis
> Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
>
> rjones_at_cincom.com wrote in message <8kfbjl$kr5$1_at_nnrp1.deja.com>...
> >I've recently noticed that in the absence of any other sequencing, the
> >position of OR statements will influence the sequence of results for a
> >simple query. Take a single column table X with values 'A', 'B'
> >and 'C', the query...
> >
> >select rownum, col from x where col = 'A' or col = 'B' or col = 'C'
> >
> >...will give:
> >
> > ROWNUM COL
> >--------- ---
> > 1 C
> > 2 B
> > 3 A
> >
> >But...
> >
> >select rownum, col from x where col = 'C' or col = 'B' or col = 'A'
> >
> >...will give:
> >
> > ROWNUM COL
> >--------- ---
> > 1 A
> > 2 B
> > 3 C
> >
> >This doesn't seem to be documented anywhere. It's a potentially useful
> >feature, if indeed it is a feature is not going to be 'fixed' in the
> >next release.
> >
> >Any thoughts???
> >
> >Rod
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Before you buy.
-- ======================================== Brian Peasland Raytheons Systems at USGS EROS Data Center These opinions are my own and do not necessarily reflect the opinions of my company! ========================================Received on Wed Jul 12 2000 - 00:00:00 CDT
![]() |
![]() |