Oracle PL/SQL Tutorial/PL SQL Programming/DBMS RANDOM
DBMS_RANDOM
SQL>
SQL> v_random_nr:= dbms_random.random;
SQL>
SQL> Returns a random integer value in the range of ?^31 to 2^31.
SQL>
SQL> declare
2 v2_nr binary_integer:=dbms_random.random;
3 begin
4 DBMS_OUTPUT.put_line("Int:"||v2_nr);
5 end;
6 /
Int:-1254017024
PL/SQL procedure successfully completed.
SQL>
v_value_nr:= dbms_random.value[(min, max)];
SQL>
SQL> --Generates a random value between the MINand MAX numbers passed as parameters (between 0 and 1 if parameters are omitted) with 38 digits after the decimal point.
SQL>
SQL> declare
2 v1_nr number:=dbms_random.value(10,15);
3 begin
4 DBMS_OUTPUT.put_line("Float:"||v1_nr);
5 end;
6 /
Float:13.1192638925165964762502277715685751274
PL/SQL procedure successfully completed.
SQL>