Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Random number and string
You could use the dbms_random package. Its use requires the
dbms_crypto_toolkit to be also installed which is not documented in the
Supplied Packages Reference. You can find the specification (dbmsoctk.ql)
and the body (prvtoctk.plb) in the $ORACLE_HOME/rdbms/admin directory. Run
these as sys.
A simple example of the dbms_random package might be the following:
create procedure rand (p in binary_integer := 987657)
is
begin
dbms_random.initialize(p);
dbms_output.put_line(to_char(dbms_random.random));
end;
SQL> exec rand(876)
1964085572
PL/SQL procedure successfully completed.
SQL> exec rand(34567)
-518802747
PL/SQL procedure successfully completed.
I wonder if anyone has tested how "random" the dbms_random.random function really is?
Frank Hubeny
Abdelkafi wrote:
> Hello,
> I would like to create a random number (within a range a value) and a
> random string within a procedure.
> Are there packages that can help me to do that (+ one example please) ?
> Bye.
Received on Tue Sep 28 1999 - 00:21:14 CDT
![]() |
![]() |