Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Random sample
You can find out about random number at:
http://www.oracle.com/st/products/features/random_down1.html
Why don't you try to generate a random number based on the count(*) of the table you are querying and then fetch through that cursor until you reach that number.
PLSQL Might go something like:
DECLARE
cursor table_cursor is
select * from MY_TABLE;
random_row table_cursor%ROWTYPE;
BEGIN
select count(*) into the_count
from MY_TABLE;
open table_cursor;
For i in 1..the_count loop
fetch table_cursor into random_row; end loop;
END; -Frank
In article <35A61AF4.B7C981AF_at_neurotec.de>,
Stefan Schmitz <sts_at_neurotec.de> wrote:
> Hi,
>
> I'm looking for an easy method (perhaps in PL/SQL) to draw a random
> sample from a oracle table.
>
> Regards,
> Stefan
>
> --
> Dipl.-Inform. Stefan Schmitz
> NEUROTEC Hochtechnologie GmbH
> Intelligente Systeme
> Ehlerstrasse 15
> 88046 Friedrichshafen
>
> Tel. +49-7541-3012-151
> Email sts_at_neurotec.de
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Fri Jul 10 1998 - 13:02:35 CDT
![]() |
![]() |