Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Help: Need Random sample of 3K from a query returning 100K
In article <8dhtl5$nep$1_at_nnrp1.deja.com>,
George <ghharrac_at_my-deja.com> wrote:
> No
>
> I need a random sample across the universe of 100K to yield
> the 3K that I need.
>
> It has to be random to the point that the tuples returned
> from successive runs are different.
>
> George
>
OK, how about this:
Using pl/sql open a cursor selecting all rowid's for target table.
Using call to dbms_random generate number of rows to skip with a small range.
Loop selecting every Nth rowid from that point.
-- Mark D. Powell -- The only advice that counts is the advice that you follow so follow your own advice -- Sent via Deja.com http://www.deja.com/ Before you buy.Received on Tue Apr 18 2000 - 00:00:00 CDT