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: A question about Randomness in Oracle?

Re: A question about Randomness in Oracle?

From: Ramana Kumar Damarla <rdamarla_at_cisco.com>
Date: Tue, 23 Mar 2004 18:14:06 -0800
Message-ID: <1080094609.708927@sj-nntpcache-3>


Paul,

Try this:
select * from (SELECT * FROM My_Table sample (10) ORDER BY My_Sequence) where rownum < 1000;

The above query will return 1000 random rows from a sample of 10%. By changing the number 10 to some other you would get different random set.

HTH
Ramana

"Paul" <paul_at_not.a.chance.ie> wrote in message news:MPG.1ac40525478d32c298990d_at_news1.eircom.net...
>
>
> Hi all,
>
>
> I have been looking at
>
> F:\oracle\ora92\rdbms\admin\dbmsrand.sql
>
> It says
>
> "This is a random number generator. Do not use for cryptography"
>
>
> Do Oracle publish any details of the algorithm they use to generate
> these numbers?
>
>
> Basically, what I have is a certain number of records, each with an
> integer (sequence), and I want to be able to do something like
>
> SELECT * FROM My_Table (RANDOM x 1000) ORDER BY My_Sequence
>
> or whatever the syntax is in Oracle. I want 1000 RANDOM records - i.e.
> if I do this tomorrow or the next day, I will get a completely different
> set of records. Is there an easy way to do this in Oracle?
>
>
> Paul...
>
>
> --
> plinehan y_a_h_o_o and d_o_t com
> C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro
> Please do not top-post.
>
> "XML avoids the fundamental question of what we should do,
> by focusing entirely on how we should do it."
>
> quote from http://www.metatorial.com
Received on Tue Mar 23 2004 - 20:14:06 CST

Original text of this message

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