select * from(select a.*,rownum rn from(select t.*from TABLENAME twhere 1=1order by dbms_random.value) a ) bwhere b.rn=1