Since a question on how to do a pagination query in Oracle pops out every now and then, and doing so correctly in Oracle is far from straightforward, I've added an entry dealing with this subject to our Oracle FAQ here:
https://coderanch.com/how-to/java/OracleFaq#paginationquery
If you're interested, please have a look there. It's possible that I've messed something up or missed an important point. Anyone can edit a wiki page, so feel free to edit it right away - or post your feedback here and I'll incorporate it. Thanks.