

The OPT parameter determines the type of string produced as follows: The STRING function returns a string of random characters of the specified length. For example, to produce random integer values between 1 and 10 truncate the output and add 1 to the upper boundary.

Use TRUNC or ROUND to alter the precision as required. If the parameters are used, the resulting number will be greater than or equal to the low value and less than the high value, with the precision restricted by the size of the high value.ĭBMS_OUTPUT.put_line('value(1,100)= ' || DBMS_RANDOM.value(1,100)) When called without parameters it produce a number greater than or equal to 0 and less than 1, with 38 digit precision.ĭBMS_OUTPUT.put_line('value= ' || DBMS_RANDOM.value) The VALUE function is used to produce random numbers with a specified range. L_seed := TO_CHAR(SYSTIMESTAMP,'YYYYDDMMHH24MISSFFFF') ĭBMS_OUTPUT.put_line('Run 1 : seed=' || l_seed) ĭBMS_OUTPUT.put_line('Run 2 : seed=' || l_seed) ĭBMS_ed (val => TO_CHAR(SYSTIMESTAMP,'YYYYDDMMHH24MISSFFFF')) If you want to be "more" random, then use a seed that is more unique, like a timestamp. In later releases it is seeded using the date, user ID, and process ID.ĭBMS_OUTPUT.put_line('i=' || i || ' : value=' || DBMS_RANDOM.value(low => 1, high => 10))

In Oracle 10g it is automatically seeded with the date. From 10g onward you don't need to explicitly call SEED.
