Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Retrieving a set of randomly chosen records (Oracle 9i)
andreas.krisor_at_gmx.net wrote:
> Hi,
>
> I need to analyze the data of very large tables (over 10 million
> records). Therefore I want to retrieve a set of randomly chosen records
> (about 50,000).
>
> Question: Exists a predefined function in Oracle 9i, which fetches a
> certain part (e.g. 1%) of the rows of a table?
>
Hi Andreas,
try this :
SELECT <stuff>
FROM <table>
SAMPLE(1);
The number in brackets (1) is the percentage of the table you want. You
will usually get a different sample on each execution. You cannot
guarantee that you will always get the same number of rows in the sample
though.
Cheers,
Norm.
Received on Fri Feb 18 2005 - 07:38:46 CST