oracle8.1.6 select * from ( select x.*, rownum as row_id from ($sql) x ) ordered_sql_query_with_row_id where row_id between $start_row and $start_row + $rows_per_page - 1