Oracle怎么分段取一个无主键的表内容
如题。最好是1000条以内一次这样。
------解决方案--------------------不是有rownum么....
------解决方案--------------------用rowid作主键排序,rownum伪列转成实列
select *
from (select t.*, rownum row_num
from t
order by t.rowid) tt
where row_num > 1000 and row_num <= 2000;
如果记录没有发生变化的话,取出的值不会有重复。
------解决方案--------------------rownum 伪列
------解决方案--------------------select * from (select t.* from table_name t where rownum<30 order by f_id) where rownum<10 order by f_id
取出的是第20-30行数据。
------解决方案--------------------select * from
(select b.*, rownum rn
from (select a.owner,a.table_name,a.num_rows
from all_tables a
where a.num_rows is not null order by a.num_rows desc)b) c
where c.rn<=50;