Re: Generate random numbers in PL/SQL, any good ways? Is there an internal?
Date: Wed, 13 Jul 1994 23:36:08 +0000
Message-ID: <774142568snz_at_aboy.demon.co.uk>
In article <d7hansl.774016863_at_dtek.chalmers.se>
d7hansl_at_dtek.chalmers.se "Hans Lindberg" writes:
> Hi!
> I'm looking for a way to generate test data with certain probabilities
> for the different values of the data. I can't find any random number
> generator in neither the SQL ref man nor the PL/SQL ditto. Am I missing
> the obvious or isn't there any? Do I have to implement a my own random
Einstein said "Only God can be random." So you need a very good freelancer.
In fact, randomness is a non-relational idea. What you have is a variant of the 'table of dates' problem - how do we generate output to tell us nothing happened on a day when there's no data for the day to drive the query. Oracle is not good at this.
In fact, without wishing to step outside the boundaries of the group, I would suggest that randomness is by definition unprogrammable. What you could do, however, is write a program that makes no *relational* sense but pulls you back a whole bunch of rowids that you sould substring to numeric format.
This would not truly be random, but it would at least be unpredictable.
M
-- ----------------------------------------------------------------------------- MarkB_at_aboy.demon.co.uk Lyric Quiz of the Week: "One and one and one is three..."Received on Thu Jul 14 1994 - 01:36:08 CEST