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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Retrieving a set of randomly chosen records (Oracle 9i)

Re: Retrieving a set of randomly chosen records (Oracle 9i)

From: Norman Dunbar <Norman_at_Dunbar-it.co.uk.REMOVETHIS>
Date: Fri, 18 Feb 2005 14:38:46 +0100
Message-ID: <cv4ucb$mdv$2$8302bc10@news.demon.co.uk>


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

Original text of this message

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