Oracle pagination for tables without primary keys and Oracle primary key tables
Generally, for tables with a primary key that can be used for unique table recognition, we can use the primary key and rownum for implementation. For example:
Select scott. emp. * from scott. emp left join (select empno id, rownum num from scott. emp) id_num on scott. emp. empno = id_num.id where id_num.num between 5 and 10;
If a table without a primary key can be replaced by a rowid, The rowid will not be sorted, queried, or even updated, so this field can be used for paging.
Select scott. emp. * from scott. emp left join (select rowid id, rownum num from scott. emp) id_num on scott. emp. rowid = id_num.id where id_num.num between 5 and 10;
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.