当前位置:Gxlcms > 数据库问题 > Oracle对没有主键的表分页

Oracle对没有主键的表分页

时间:2021-07-01 10:21:17 帮助过:38人阅读

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;

假设遇到没有主键的表能够尝试rowid取代。rowid不会由于排序或者查询,甚至update都不会改动,因此能够借助这个字段作分页。

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;

Oracle对没有主键的表分页

标签:print   查询   var   情况   排序   oracle   join   app   div   

人气教程排行