Skip to content

Instantly share code, notes, and snippets.

@searock
Created December 9, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searock/32c2b31288619b5b48c9 to your computer and use it in GitHub Desktop.
Save searock/32c2b31288619b5b48c9 to your computer and use it in GitHub Desktop.
Oracle pagination query
SELECT *
FROM (SELECT R.*, ROWNUM RNUM, COUNT(*) OVER () RESULT_COUNT
FROM (SELECT i.ITEM_CODE, i.ITEM_NAME
FROM TBL_ITEMS i) R)
WHERE RNUM between 0 and 9 ;
@searock
Copy link
Author

searock commented Dec 10, 2015

To select all columns use i.*
Row number can start from 1 and can limit to 10 for fetching 10 records

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment