Monday, November 19, 2007

Oracle Sort Paging

Oracle does not have the keyword limit like mysql, you have to select couple of rows and limit them by rownumbers, this may cause problems when sorting because you may only sort the set that you have selected, so first select and sort all then limit by rownums

select * from
    (select p.*, rownum r from
        (select * from all_objects order by object_name) p
    where rownum < 20)
where r > 10;

THANKS ASKTOM

No comments: