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: Randomizing Functionality?

Re: Randomizing Functionality?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 26 Jan 1999 21:28:17 +0100
Message-ID: <36AE2560.5A91B00A@sybrandb.demon.nl>


Hi Frank,

Oracle 7 doesn't, Oracle 8 does have a random function. Recently I had to write one myself, as we didn't consider it wise to upgrade this customer to Oracle 8. (We are in a development traject and don't want to introduce upgrade problems). What I did was the following:
I took the system time, multiplied that by a large amount. Then I log of that number, the base of the log being the number of times the function has been called, and forced that into the range 1..100. Just an idea, it seemed to work, regrettably I left the code with that customer.

Hth,

Sybrand Bakker, Oracle DBA

Frank Siegel wrote:

> I have a table with 300K rows with each row numbered
> 1 to 300,000 (not an Oracle sequence object). Let's
> call this column PAT_NUM. It is my understanding
> that Oracle does not have a RANDOM function.
>
> Do you know of a random algorithm I can use to select
> random rows based on the the coulmn PAT_NUM?
>
> I have the user of a cursor within a stored procedure
> if it would help. Or I can use PL/SQL programming
> constructs within a stored procedure is that helps.
>
> Please shed some light! Thanks!
> Frank S., New Hampshire


Received on Tue Jan 26 1999 - 14:28:17 CST

Original text of this message

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