Re: find position of row in set of rows

From: joel garry <>
Date: Fri, 29 Jan 2010 13:41:58 -0800 (PST)
Message-ID: <>

On Jan 28, 10:49 am, cate <> wrote:
> I have a table ordered by date.  When I find a specific record in this
> set, I want to know what its position is in this ordered list.
> I could get the date from the record found and count dates above or
> below, but is there a better way?
> Thank you.

You might want to test if counting the dates above and below might be the better way. Ordering comes from sorts or indices, since you say the table is ordered by date, that implies you have an index on date. So if you count the dates, Oracle might be able to get that from the index, which may be smaller and faster than even analytics on the original table (or index?), with its different possible ways of extracting then sorting. Dependent on actual data distribution and layout and code and usage, of course. Not sure why you'd need above, wouldn't you just need below?


-- is bogus.
At least it doesn't have flash...
Received on Fri Jan 29 2010 - 15:41:58 CST

Original text of this message