Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBMS_ Packages 1

Status
Not open for further replies.

ut83

MIS
Jan 12, 2001
4
US
Are there any DBMS_ Oracle packages that generate random numbers?

Thank you
John Ellis
 
DBMS_RANDOM is what you're looking for.

The following are the programs it contains:
INITIALIZE - gives the random no. generator a seed.
RANDOM - returns a random no.
SEED - resets the generator seed no.
TERMINATE - ends the random no. mechanism.

To run it you need to run

DBMS_RANDOM.Initialize( seed IN BINARY_INTEGER) - where seed is a number you supply with > 5 digits to ensure, er, randomness....

Then you can call
FUNCTION DBMS_RANDOM.RANDOM return BINARY_INTEGER
This will give you a random no.

If you need lots of them you can use the SEED procedure (parms as per Initialize) to reset the generator.

Finally when you're done you should call
PROCEDURE DBMS_RANDOM.TERMINATE
to free up any memory used by the package...

Enjoy!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top