1, take the record from the table randomly
SELECT * FROM (SELECT * to Staff ORDER by Dbms_random.random) indicates that 3 records are randomly taken from the staff table
Where RowNum < 4
2. Produce random number
SELECT Dbms_random. RANDOM from DUAL;
Produces a random number of any size
SELECT ABS (MOD (dbms_random). random,100)) from DUAL;
Produces a random number within 100.
SELECT TRUNC (100+900*dbms_random.value) from dual;
Produces a random number between 100~1000.
SELECT Dbms_random.value from dual;
Produces a random number between 0~1.
SELECT Dbms_random.value (10,20) from dual;
Produces a random number between 10~20.
SELECT dbms_random.normal from dual;
The normal function returns the number of groups that are subject to a normal distribution. The standard deviation of this normal distribution is 1 and the expected value is 0. 68% of the values returned by this function are between 1 and +1, 95% between-2 and +2, and 99% between 3 and +3.
3. Generate Random string
SELECT dbms_random.string from dual;
Returns a random string of up to 60 characters in length. (not tested successfully)
Select Dbms_random.string (' P ', m) from dual;
The first argument P represents printable, that is, the string is composed of any printable character
The second parameter indicates the length of the return string