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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Last 100 rows

Re: Last 100 rows

From: Mark D Powell <markp7832_at_my-deja.com>
Date: 2000/04/25
Message-ID: <8e443n$21h$1@nnrp1.deja.com>#1/1

In article <8e2biq$bsj$1_at_newsg3.svr.pol.co.uk>,   "Jim Harrison" <jim_at_colway.freeserve.co.uk> wrote:
> How about:
> select *
> from huge_tab
> where rownum <= 100
> order by order_col DESC;
>

This is not correct. The rownum is applied to the first 100 rows retrieved and these are what are sorted. This means your result set is not guarenteed to hold the largest value for order_col since it may be located at a rownum >= 100.

--
Mark D. Powell  -- The only advice that counts is the advice that
 you follow so follow your own advice --


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Apr 25 2000 - 00:00:00 CDT

Original text of this message

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