Created
July 19, 2018 10:59
-
-
Save rusco/70a47bccb1c7fdb79f16269c0c633763 to your computer and use it in GitHub Desktop.
paging of system tables in Oracle v12 Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH f | |
AS (SELECT object_name, | |
created, | |
ROWNUM rn, | |
COUNT (*) OVER (PARTITION BY NULL) cnt | |
FROM (SELECT object_name, created | |
FROM user_objects | |
WHERE ROWNUM < 17 --some kind of restriction | |
ORDER BY object_name)) | |
SELECT f.*, | |
CEIL (cnt / 4), | |
CASE | |
WHEN rn <= CEIL (cnt / 4) THEN 1 | |
WHEN rn BETWEEN CEIL (cnt / 4) AND CEIL (cnt / 4) * 2 THEN 2 | |
WHEN rn BETWEEN CEIL (cnt / 4) * 2 AND CEIL (cnt / 4) * 3 THEN 3 | |
ELSE 4 | |
END | |
filtro | |
FROM f | |
ORDER BY object_name, filtro; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment