Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to fetch random rownum from a table

user8094949Feb 18 2011 — edited Feb 18 2011
Hi All

I need to fetch two random records from a table each time I query it. e.g. my_emp_table if this contains unique employee ids, is there any way to write a query which would give a two random employee records, say for first run 11 and 18 and next time 20 and 28 employee record.

We can get random values by select TRUNC(dbms_random.value(1,250)), TRUNC(dbms_random.value(1,250)) num from dual
but how do I use these values to get the Nth record using sql?

Any help will be appreciated.

Many Thanks!!
- Shashank
This post has been answered by Anton Scheffer on Feb 18 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2011
Added on Feb 18 2011
10 comments
2,289 views