Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Select random number from a list

Select random number from a list

From: Robert Scheer <rbscheer_at_my-deja.com>
Date: 19 Apr 2006 08:20:53 -0700
Message-ID: <1145460053.811233.45660@g10g2000cwb.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US