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

Building a random function

From: Michael S. Post <mpost_at_cftconsulting.com>
Date: 15 Jul 1999 12:06:39 PDT
Message-ID: <7mlbfv$79p@journal.concentric.net>


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 Received on Thu Jul 15 1999 - 14:06:39 CDT

Original text of this message

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