简单得说,通过dbms_random包调用随机数的方法大致有4种:
1、dbms_random.normal
这个函数不带参数,能返回normal distribution的一个number类型,所以基本上随机数会在-1到1之间。
简单测试了一下,产生100000次最大能到5左右:
Sql代码
declare
i number:=;
j number:=;
begin
for k in .. loop
i:= dbms_random.normal;
i
利用oracle的dbms_random包结合rownum来实现,示例如下,随机取499户: select * from ( select * from busi.t_ar_userinfo order by dbms_random.value) where rownum < 500; 有关dbms_random的参考文献,链接为:http://www.psoug.org/reference/dbms_random.html Deprecated. Use the methods in t