Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Select random number from a list
Hi.
I have a table that will always have few records. In one of my procedures I need to get the values from one of the fields of this table, and randomly select one value from this list. This value will be used to update a record on another table.
I am using Oracle 10g and read about the DBMS_RANDOM and DBMS_RANDOMINTEGER but they can't help me, since I need to select a value among a predefined list of values. Also, I tried the SAMPLE clause, but there are times that the query returns no rows.
How can I code a procedure or function to return a random number from a predefined list of values?
Thanks,
Robert Scheer
Received on Wed Apr 19 2006 - 10:20:53 CDT