selectdbms_random.random from dual;
select abs(mod(dbms_random.random,100)) from dual;-- generate a random number between 0 and 100.
selecttrunc(100+900*dbms_random.value) from dual; -- 100~1000
selectdbms_random.value from dual; --0~1
selectdbms_random.value(10,20) from dual; --10~20
selectdbms_random.normal from dual;/* NORMAL函数返回服从正态分布的一组数。此正态分布标准偏差为1,
期望值为0。这个函数返回的数值中有68%是介于-1与+1之间,95%介于-2与+2之间,
99%介于-3与+3之间。*/
selectdbms_random.string('P',20) from dual; /** the first parameter means printable character.
the second parameter means the length of string**/
select /*+ ordered use_nl(t1 t2) */ id, user_id, age, gmt_create
from (select rid
from (select rid, rownum as rn
from (select rowid as rid
from test where user_id = :1
order by gmt_create desc)
where rownum <= :2)
where rn >= :3) t1, test t2
where t1.rid = t2.rowid
from (select rid
from (select rid, rownum as rn
from (select rowid as rid
from test where user_id = :1
order by gmt_create desc)
where rownum <= :2)
where rn >= :3) t1, test t2
where t1.rid = t2.rowid