Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

any efficient way to select data with limit?

707594Mar 9 2011 — edited Mar 10 2011
HI
I want to select some rows of my table for showing in a webpage
number of rows is very very much and all of them cannot be showed in one page, so i used paging for my webpage
every page has just 20 rows
problem is here , how to select rows between 400 and 420 ( for example)

i am using this way of query:

select * from
*(*
select col1,col2,col3, rownum as r_n
from my table
where ... and .... and ... and ...
order by id desc
*)*
where r_n between 400 and 420


this query works, but it is slow. i think database first run inner query and select all rows then select those ones that are in my range
is there any other efficient way to do this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2011
Added on Mar 9 2011
8 comments
663 views