Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Random numbers repeating

Random numbers repeating

From: Sean <dolans_at_my-deja.com>
Date: Tue, 21 Nov 2000 23:25:31 GMT
Message-ID: <8vf092$dqu$1@nnrp1.deja.com>

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. Received on Tue Nov 21 2000 - 17:25:31 CST

Original text of this message

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