主页 > 知识库 > 数据库 > Oracle >

oracle取随机结果测试

来源:中国IT实验室 作者:佚名 发表于:2013-07-16 15:45  点击:
oracle取随机结果测试 create table t as select * from all_objects where rownum = 5000; select object_name, object_id from ( select object_name, object_id from t where object_name like %% order by dbms_random.random ) where rownum = 4; selec
 oracle取随机结果测试  create table t as select * from all_objects where rownum <= 5000;
  select object_name, object_id
  from ( select object_name, object_id
  from t
  where object_name like '%%'
  order by dbms_random.random )
  where rownum <= 4;
  select object_name, object_id
  from ( select object_name, object_id
  from t sample ( 1 )
  where object_name like '%%'
  order by dbms_random.random )
  where rownum <= 4;
  create table tt(ss number(10));
  declare
  v_out number(3);
  i     number(10);
  begin
  i := 1;
  while i <= 10000 loop
  begin
  insert into tt values(i);
  i := i + 1;
  end;
  end loop;
  --dbms_output.put_line(v_out);
  end;
  /
  commit;
  select dbms_random.random from dual;
  select * from (select * from tt order by dbms_random.random) where rownum<11;

有帮助
(0)
0%
没帮助
(0)
0%
  • 2013-07-16 15:47:09oracle rownum分页出现重复数
  • 2013-07-16 15:44:51oracle表间多字段连接
  • 2013-07-16 15:43:48oracle空串比较
  • 2013-07-15 15:25:53修改oracle内存占用
  • 2013-07-12 12:15:13Oracle数据库编程:PL/SQL编程
  • 2013-07-12 12:13:34Oracle常用脚本——卸载Grid C