Returning N Random Records From A Table
Returning N Random Records From A Table
Use the built-in function VALUE, found in the built-in package DBMS_RANDOM, in conjunction
with ORDER BY and the built-in function ROWNUM:
1 select *
2 from (
3 select ename, job
4 from emp
6 order by dbms_random.value()
7 )
8 where rownum <= 5