Oracle BuildRandomThe string method is done byDbms_random. String is implemented.
1.dbms_random.string usage
Oracle Official Documentation Reference Link: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_random.htm#i996825
usageIt's dbms_random. String (option, return string length)
Options are available in the following ways:
1) ' U ', ' u '-returningstringIn uppercase Alpha characters
2) ' l ', ' l '-returning string in lowercase alpha characters
3) ' A ', ' a '-returning string in mixed case alpha characters
4) ' x ', ' X '-returning string in uppercase Alpha-numeric characters
5) ' P ', ' p '-returning string in any printable characters.
6) Otherwise The returning string is in uppercase alpha characters.
2. Take the simple requirement of randomly generating 8-bit passwords to illustrate the use of individual options
1) Generate 8-bit passwords consisting of uppercase letters
[Email protected]> Select dbms_random.string (' U ', 8) "U_8_password" from dual;
U_8_password
------------------------------------------------------------------
Hxgbmncf
[Email protected]> Select dbms_random.string (' U ', 8) "U_8_password" from dual;
U_8_password
------------------------------------------------------------------
Jezldjxk
2) Generate a 8-bit password consisting of lowercase letters
[Email protected]> Select dbms_random.string (' l ', 8) ' L_8_password ' from dual;
L_8_password
------------------------------------------------------------------
Ilxpvvmy
[Email protected]> Select dbms_random.string (' L ', 8) ' L_8_password ' from dual;
L_8_password
------------------------------------------------------------------
Pzvjvpji
3) Generate 8-bit passwords mixed with uppercase and lowercase letters
[Email protected]> Select dbms_random.string (' a ', 8) "A_8_password" from dual;
A_8_password
------------------------------------------------------------------
Yfeanezx
[Email protected]> Select dbms_random.string (' A ', 8) "A_8_password" from dual;
A_8_password
------------------------------------------------------------------
Ighqwavu
4) Generate 8-bit passwords consisting of uppercase letters and numbers
[Email protected]> Select dbms_random.string (' x ', 8) "X_8_password" from dual;
X_8_password
------------------------------------------------------------------
2vkq4fsh
[Email protected]> Select dbms_random.string (' X ', 8) "X_8_password" from dual;
X_8_password
------------------------------------------------------------------
MMYTPC40
5) Generate a 8-bit password consisting of any printable characters
[Email protected]> Select dbms_random.string (' P ', 8) "P_8_password" from dual;
P_8_password
------------------------------------------------------------------
G7 ' Rbe#v
[Email protected]> Select dbms_random.string (' P ', 8) "P_8_password" from dual;
P_8_password
------------------------------------------------------------------
Wpqht*0.
6) The returned content will still be uppercase when the item is selected as a different letter
Option with "8" for example, the returned 8-bit random string content is made up of uppercase letters.
[Email protected]> Select dbms_random.string (' 8 ', 8) "8_8_password" from dual;
8_8_password
------------------------------------------------------------------
Pjgypplg
3. Summary
This paper demonstrates the use of dbms_random.string in the form of concrete examples. Sometimes it can be mixed.
[Email protected]> Select dbms_random.string (' U ', 8) | | Dbms_random.string (' l ', 8) "U_l_16_password" from dual;
U_l_16_password
------------------------------------------------------------------
Emvxozlgixziwvny
good luck.
Reference: http://blog.itpub.net/25746731/viewspace-693735/
"Turn" about the method of generating Oracle random string and its specific application