select * from (select * from tablename order by dbms_random.value) where rownum < N; 例: select * from (select * from tablename order by dbms_random.value) where rownum < 3;
注:dbms_random包需要手工安装,位于$ORACLE_HOME/rdbms/admin/dbmsrand.sql dbms_random.value(100,200)可以产生100到200范围的随机数
按概率抽取: select * from tablename sample(百分比); 例: select * from tablename sample(10); |
原文:http://lingoosoft.blog.ccidnet.com/blog-htm-itemid-154346-do-showone-type-blog-uid-37700.html
阅读(387) | 评论(0) | 转发(0) |