![]() 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.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |