Oracle8i Supplied Packages Reference Release 8.1.5 A68001-01 |
|
The DBMS_RANDOM
package provides a built-in random number generator. It is faster than generators written in PL/SQL because it calls Oracle's internal random number generator.
DBMS_RANDOM
must be initialized prior to calling the random number generator. The generator produces 8 digit integers. If the initialization subprogram is not called, then the package raises an exception.
Subprogram | Description |
---|---|
|
Initializes the package with a seed value. |
|
Resets the seed. |
|
Gets the random number. |
|
Closes the package. |
To use the package, first call the initialize subprogram with the seed to use.
DBMS_RANDOM.INITIALIZE ( seed IN BINARY_INTEGER);
Parameter | Description |
---|---|
seed |
Seed number used to generate a random number. |
This procedure resets the seed.
DBMS_RANDOM.SEED ( seed IN BINARY_INTEGER);
Parameter | Description |
---|---|
|
Seed number used to generate a random number. |
This function gets the random number.
DBMS_RANDOM.RANDOM RETURN BINARY_INTEGER;
None.
my_random_number := Random;
When you are finished with the package, call the TERMINATE
procedure.
DBMS_RANDOM.TERMINATE;
None.