我想从一个数据表里随机查询100条记录,写的sql语句为:
select   *   from   samplewatchlogtemp     
where   rownum=(select   trunc(dbms_random.value(1,1000))   from   dual);sqlplus 里返回“未选定行”。然后我使用 select rownum from samplewatchlogtemp; 能够查询表中的各条记录的rownum值,然后我再使用 select * from samplewatchlogtemp where rownum=某个rownum值;还是返回“未选定行”。这是为什么??急!!!!

解决方案 »

  1.   

    rownum betwen xx and xxx
      

  2.   

    select   *   from   samplewatchlogtemp     
    where row_num<101;--前100条
      

  3.   

    rownum是不能用=的建议随即产生卡号后用
    select * from emp where rownum<2 and rowid not in (select rowid from emp where rownum<11);这是例子  看一下吧   11 可以换成你产生的随即号
      

  4.   

    http://vbagcl.blog.hexun.com/有答案,去看看吧,不想重写啦
      

  5.   

    还没解决吗?没去http://hexun.com/vbagcl/default.html
    里面看看,点击标签oracle就可找到,有问题给我留言。