November 22, 2024

DB2 does not have the built-in ability to only return a page of data in a select query. In MySQL, you can do this by:

select * from test_table limit 10,5

DB2 doesn’t support any limit functionality. But, it turns out there is a tricky way to do it:

select * from
( select rownumber() over(order by test_col asc) as row_,
test_col
from test_table
order by test_col asc )
where row_ between 10 and 15