Re: find position of row in set of rows
Date: Fri, 29 Jan 2010 13:41:58 -0800 (PST)
On Jan 28, 10:49 am, cate <catebekens..._at_yahoo.com> 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?
-- _at_home.com is bogus. At least it doesn't have flash... http://www.signonsandiego.com/news/2010/jan/28/shiny-gadget-icky-name-ipad-jokes-fly-on-web/Received on Fri Jan 29 2010 - 15:41:58 CST