--从一个表中随机取一条记录 --1.dbms_random.value select * from(select * from table1 order by dbms_random.value) where rownum < 2; --2.dbms_random.random select * from(select * from table1 order by dbms_random.random) where rownum < 2; --3.sys_guid() select * from(select * from table1 order by sys_guid()) where rownum < 2; --4.sample(20) 按百分比 select * from(select * from table1 sample(20)) where rownum < 2; --5.sample block(20) 按数据块 select * from(select * from table1 sample block(40)) where rownum < 2; 随机地从表中获取一条记录
--从一个表中随机取一条记录
--1.dbms_random.value
select * from(select * from table1 order by dbms_random.value) where rownum < 2;
--2.dbms_random.random
select * from(select * from table1 order by dbms_random.random) where rownum < 2;
--3.sys_guid()
select * from(select * from table1 order by sys_guid()) where rownum < 2;
--4.sample(20) 按百分比
select * from(select * from table1 sample(20)) where rownum < 2;
--5.sample block(20) 按数据块
select * from(select * from table1 sample block(40)) where rownum < 2;
随机地从表中获取一条记录
else保存进数据库