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: help with work project - completely random sample but all numbers picked within 12 tries

Re: help with work project - completely random sample but all numbers picked within 12 tries

From: Michael Austin <maustin_at_firstdbasource.com>
Date: Wed, 09 Jun 2004 19:38:23 GMT
Message-ID: <PGJxc.3761$OI.392@newssvr24.news.prodigy.com>


D wrote:
> This is where my math classes should have come in handy...
>
> I want to do a random sampling of a database of 100k records. I need
> to completely randomly select a group of records to be processed each
> month for a year (12 times). A record can be processed more than once
> and that is preferred- some records must be pulled twice in a year.
> All records need to be processed by the end of the year (the twelfth
> sampling).
>
> My idea is to write a random number generator to pick about 10% of the
> numbers for 10 months and then split the remaining unchosen numbers up
> for the last two months. The problem is that this will have to pass
> the eyes of a lawyer to prove it's truly random. I have never worked
> with randomization before and I don't want to get hung up here.
>
> So how would you do this? Can I write a PL/SQL SP to do this? Does
> anyone have any examples to share or to point to on the web?
>
> thanks,
>
> Don

By the mere definition, you should NEVER pull ALL the records. This makes it ALL, not Random - even if it does occur over a 1 year period.

One of the issues you will have right off the bat is, how do you determine if a record has already been "randomly" chosen but also make it choosable again... When you get down to the last month, you must select only those that have not been selected before. Not very random, is it?? And depending on the rate new records are added, that last month will have a much larger sampling than any of the other 11, especially if you are having some records pulled more than once.

But to answer the question, use rowid with your random number generator.

Michael. Received on Wed Jun 09 2004 - 14:38:23 CDT

Original text of this message

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