????3. RANDOM
????RANDOM????????Χ??? [-2^31?? 2^31)???????????????
????????
????DBMS_RANDOM.RANDOM
????RETURN binary_integer;
??????????
????SQL> select dbms_random.random from dual;
????RANDOM
????----------
????-1.363E+09
????4. SEED
?????????INITIALIZE???????????????INITIALIZE???????????????????????????SEED????????INITIALIZE???????????SEED?????????????????????????????INITIALIZE?????????????
????????
????DBMS_RANDOM.SEED (
????val IN BINARY_INTEGER);
????DBMS_RANDOM.SEED (
????val IN VARCHAR2);
??????????
????BEGIN
????dbms_random.seed('hello');
????FOR i IN 1 .. 10 LOOP
????dbms_output.put_line(round(dbms_random.value * 100));
????END LOOP;
????END;
??????????£?
????58
????71
????33
????4
????39
????53
????93
????37
????20
????5
???????У?VARCHAR2???Χ?2000.
????5. STRING
????????????????
????????
????DBMS_RANDOM.STRING
????opt IN CHAR??
????len IN NUMBER)
????RETURN VARCHAR2;
????????opt??len??????????????£?
?????????opt????????????????len????????????????
??????????
SQL> select dbms_random.string('u'??10) value from dual;
VALUE
--------------------
MCPEZLEQOO
SQL> select dbms_random.string('l'??10) value from dual;
VALUE
--------------------
laufaqufln
SQL> select dbms_random.string('a'??10) value from dual;
VALUE
--------------------
vjEetXlItt
SQL> select dbms_random.string('x'??10) value from dual;
VALUE
--------------------
LAMDGZE22E
SQL> select dbms_random.string('p'??10) value from dual;
VALUE
--------------------
4LF =Q'(fP