http://www.cnblogs.com/lgzslf/archive/2008/11/29/1343685.html
select substr(dbms_random.random,2,2) random from (select * from dual order by dbms_random.random)
1、从表中随机取记录 select * from (select * from staff order by dbms_random.random) 表示从STAFF表中随机取3条记录 2、产生随机数 SELECT DBMS_RANDOM.RANDOM FROM DUAL; SELECT ABS(MOD(DBMS_RANDOM.RANDOM,100)) FROM DUAL; SELECT TRUNC(100+900*dbms_random.value) FROM dual; SELECT dbms_random.value FROM dual; SELECT dbms_random.value(10,20) FROM dual; SELECT dbms_random.normal FROM dual; 3、产生随机字符串 select dbms_random.string('P',20) from dual; |