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: Building a random function

Re: Building a random function

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sat, 17 Jul 1999 14:06:51 +0800
Message-ID: <37901D7B.5F18@yahoo.com>


Michael S. Post wrote:
>
> I am looking for a random function that I can put into a SQL statement. I
> know such a function does not exist; I'm interested in the best way to make
> it.
> I need to run something like the following:
>
> select field1, field2
> from table1
> order by (field1 - field2) * 100 + random(100)
>
> where random(100) returns a number x where 0 <= x < 100.
> Since the random() function is being called independently each time, how
> does a seed get set properly?
>
> Michael Post
> CFT Consulting, Inc.
> mpost_at_cftconsulting.com

Oracle 8 has a built-in random function...(I think its dbms_random) --



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Sat Jul 17 1999 - 01:06:51 CDT

Original text of this message

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