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

Home -> Community -> Usenet -> c.d.o.server -> Re: Is there any RANDOM functions in PL/SQL?

Re: Is there any RANDOM functions in PL/SQL?

From: Sean M. Dillon <sdillon_at_us.oracle.com>
Date: Fri, 14 Jan 2000 08:33:57 -0500
Message-ID: <USR=OCwG23e6TKR8lDlssVhTgXrU@4ax.com>


In Oracle 8 (and up...)

> cd $ORACLE_HOME/rdbms/admin
> grep -in DBMS_RANDOM *

dbmsrand.sql:22:CREATE OR REPLACE PACKAGE dbms_random AS
dbmsrand.sql:61:END dbms_random;
dbmsrand.sql:63:CREATE OR REPLACE PACKAGE BODY dbms_random AS
dbmsrand.sql:107:END dbms_random;
dbmsrand.sql:109:DROP PUBLIC SYNONYM dbms_random;
dbmsrand.sql:111:CREATE PUBLIC SYNONYM dbms_random FOR sys.dbms_random;
dbmsrand.sql:113:GRANT EXECUTE ON dbms_random TO public;

SQL> desc DBMS_RANDOM
PROCEDURE INITIALIZE

 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 SEED                           BINARY_INTEGER          IN
FUNCTION RANDOM RETURNS BINARY_INTEGER
PROCEDURE SEED
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 SEED                           BINARY_INTEGER          IN
PROCEDURE TERMINATE For versions 7.x and before, visit:

http://govt.oracle.com/~tkyte/Misc/Random.html

which explains how to create your own DBMS_RANDOM package in PL/SQL.

hope this helps...

On 07 Jan 2000 17:05:03 EST, "Daniel" <delj_at_flash.net> wrote:

>No built in functions that I am aware of.
>
>Daniel
>Austin, Texas
>
>"Weidong Zhou" <weidong.zhou_at_sabre.com> wrote in message
>news:38765E7C.C0179D68_at_sabre.com...
>> My PL/SQL procedure needs a RANDOM function like random( 0, 1000 ) to
>> generate random number between 0 and 1000. Anyone knows whether ORACLE
>> has this kind functions? Thanks a lot.
>>
>> Weidong Zhou
>>
>>
>

--
Sean Dillon
Oracle Corporation
sdillon_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Jan 14 2000 - 07:33:57 CST

Original text of this message

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