Friday, March 20, 2009

Random Password Generation

Many a times we generate random password for user in PeopleSoft ( eg. New Oprid) and then send this auto-generated password via Email. In PeopleCode, we can use the Rand function to generate a random number greater than or equal to 0 and less than 1. For example:
&password="ABC" | Int(Rand( )*1000);
In case we want to generate random password using SQL ( say in Set-based processing) we can use DBMS_RANDOM package in Oracle.
SELECT DBMS_RANDOM.STRING('P', 10) FROM PS_INSTALLATION;
(Reference: Generating random numbers and strings in Oracle)

No comments:

Post a Comment