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 -> Re: Select random number from a list

Re: Select random number from a list

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 19 Apr 2006 08:37:05 -0700
Message-ID: <1145461025.829790.16720@j33g2000cwa.googlegroups.com>


Here is one idea for you to consider: Load the data into a pl/sql table (array) and use dbms_randon to generate a value used as the key into the pl/sql table.

If the randomization of the selected data did not have to be truely randon you could substitute the seconds since midnight for a randon number as the input to the array slot selection.

Note both suggestions above will require distributing the return value into your number of array buckets, but allocating randon numbers into a range of desired values is a pretty standard operation. You can use MOD for this.

HTH -- Mark D Powell -- Received on Wed Apr 19 2006 - 10:37:05 CDT

Original text of this message

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