Sys_guid (): Sys_guid () is a function provided after Oracle 8i. Sys_guid generates and returns a globally unique identifier (the original value) consisting of 16 bytes. More suitable for multiple database data integration use (---from Baidu Encyclopedia). Itpub discussed these two, found that Sys_guid () and operating system-related, it is said to work normally under Windows, but in some systems may not (not verified)
Dbms_random is an immediate package, where the specific functions are described in the following forwarded a good blog post
1.dbms_random.value method
Dbms_random is a package that can generate random numbers or strings. This package has several functions such as initialize (), seed (), terminate (), value (), Normal (), random (), string (), but value () is the most commonly used, and the use of value () generally has two species, the first
function value return number;
This usage has no parameters and returns a numeric value with a 38-bit precision ranging from 0.0 to 1.0, but not 1.0, as shown in the following example:
Sql> set Serverout on
Sql> begin
2 for I in 1..10 loop
3 Dbms_output.put_line (Round (dbms_random.value*100));
4 End Loop;
5 end;
6/
46
19
45
37
33
57
61
20
82
8
The PL/SQL process has completed successfully.
Sql>
The second value has two parameters, the first refers to the lower bound, the second is the upper limit, will generate the lower bound to the upper limit of the number, but does not contain the upper limit, "learning" brother said the second, as follows:
Sql> begin
2 for I in 1..10 loop
3 Dbms_output.put_line (Trunc (Dbms_random.value (1,101)));
4 End Loop;
5 end;
6/
97
77
13
86
68
16
55
36
54
46
The PL/SQL process has completed successfully.
2. Dbms_random.string method
Some user management programs may need to create a random password for the user. This can be done using the dbms_random.string under 10G.
For example:
sql> Select dbms_random.string (' P ', 8) from dual;
Dbms_random. STRING (' P ', 8)
--------------------------------------------------------------------------------
3q<m " yf[
The meaning of the first parameter:
' u ', ' U '-returning string in uppercase Alpha characters
' l ', ' l '-returning string In lowercase alpha characters
' a ', ' a '-returning string of mixed case Alpha characters
' x ', ' X '-returning s Tring in uppercase Alpha-numeric
characters
' P ', ' p '-returning string in any printable characters.
Otherwise the returning string is in uppercase Alpha
characters.
P represents printable, where a string is made up of any printable character
and the second parameter represents the length of the string returned.
3. Dbms_random.random method
Random returns a value of type Binary_integer that produces a random number of any size
Examples of differences with Dbms_random.value:
Order BY Dbms_random.value, this statement function is to implement random sorting of records.
Other than that:
What is the difference between Dbms_random.value and dbms_random.random?
1>order by Dbms_random.value, a random number is computed for each row of the result set, and Dbms_random.value is a column of the result set (although the column is not in the select list) and then sorted according to that column. The order of the obtained is naturally random.
2> look at the DESC message and know the difference between the vlue and the random functions, value returns the number type, and the value returned is between 1 and 0, and random returns the Binary_integer type, which is stored in binary form. It is said that the efficiency of the operation is higher than the number but I have not tested, but the value range is certainly less than, the specific limit to check information.
If you want to implement random sorting, use the value function.
4. Dbms_random.normal method
The normal function returns a set of numbers that obey a normal distribution. This normal distribution has a standard deviation of 1 and a expected value of 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.
5. Dbms_random.send method
Used to generate a random number seed, the purpose of seeding is to repeat the generation of random numbers for debugging. Otherwise, it is difficult to dispatch each time.
Http://www.cnblogs.com/yang-csharp/articles/2457203.html
Oracle about several random functions Sys_guid, Dbms_random.random, Dbms_random.value (take a random result set)