--方法一:
select * from (select * from t1 order by sys_guid()) where rownum < 100;
--方法二:
select * from
(
select * from user_tables order by dbms_random.value)
where rownum < 101;
至于效率,像这种分页查询,
可以考虑加hint,或者用分析函数什么的。
如hint /*+ FIRST_ROWS() */
或者分析函数:
select * from
(select table_name, row_number() over (order by dbms_random.value) rn from user_tables )
where rn < 51
--方法三:
select * from user_tables SAMPLE(10);