Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Random numbers repeating
Sean wrote:
>
> Environment : Win NT 4.0, Oracle 8.1.6 (no java option installed)
>
> Scenario: Made a quick function that returns a 9 digit/character
> string. Works wonderfully. It is seeded with the date time:
> seedValue := to_number( to_char(
> sysdate, 'DDHH24MISS' ) ) ;
> dbms_random.Initialize(seedValue);
>
> and then I do my thing.
>
> Problem: I have a package that needs to call this function multiple
> times to get a series of random strings. The problem is Oracle is so
> fast that my seed value is probably the same each time through which
> results in similar results every time.
>
> For example, :
> BEGIN
> dbms_output.put_line(fn_getRandomString);
> dbms_output.put_line(fn_getRandomString);
> END;
> /
> gives me :
> YYRLKBCTT
> YYRLKBCTT
>
> I need them different. Any ideas on how to change the seedvalue so I
> can get different numbers?
>
> thanks,
> Sean
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Try dbms_utility.get_time
or from a sequence
or from a call to the random generator itself..
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk (mirrored at http://www.oradba.freeserve.co.uk) "Some days you're the pigeon, some days you're the statue"Received on Wed Nov 22 2000 - 05:02:05 CST
![]() |
![]() |