function createString(n_num in number) return varchar2 is
i integer default 0;
v_token varchar2(50) default '';
begin
while i < n_num loop
if mod(round(dbms_random.value(1, 2)), 2) > 0 then
--生成字符
if (mod(round(dbms_random.value(1, 2)), 2) > 0) then
--生成大写字符
v_token := concat(v_token,
chr(65 + floor(dbms_random.value(0, 26))));
else
--生成小写字符
v_token := concat(v_token,
chr(97 + floor(dbms_random.value(0, 26))));
end if;
else
--生成数字
v_token := concat(v_token,to_char(floor(dbms_random.value(0, 10))));
end if;
i := i + 1;
end loop;
return v_token;
end;