How to generate password alpha numeric value

Advertisement
dear friends,
i have written a simple pl/sql to generate a password.
declare
cursor c1 is select * from passwd;
begin
for I in c1
loop
if I.pfno < 3000 then
update passwd set pwd=I.pfno where i.pfno=pfno;
ELSe
update passwd set pwd=lpad(round(I.pfno/20520),4,'0') where i.pfno=pfno;
commit;
end if;
end loop;
end;
In this the pfno is 8 digit alpha numeric. I get password generated when it is only numeric but how could i get if pfno is like 04MAS155.
Kindly help as i have to generate the same as early as possible. I have already been given with procedure to generate random password by our guys but still as i had already generated password to some employees in my concern based on querries like above i request your help to generate for alpha numeric 8 digit number.
Advertisement

Replay

-- get a random string
    FUNCTION string (opt char, len NUMBER)
          /* "opt" specifies that the returned string may contain:
             'u','U'  :  upper case alpha characters only
             'l','L'  :  lower case alpha characters only
             'a','A'  :  alpha characters only (mixed case)
             'x','X'  :  any alpha-numeric characters (upper)
             'p','P'  :  any printable characters
        RETURN VARCHAR2;  -- string of <len> characters (max 60)
    PRAGMA restrict_references (string, WNDS);