国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

MySQL 隨機(jī)密碼生成代碼

2020-01-19 00:18:18
字體:
供稿:網(wǎng)友
復(fù)制代碼 代碼如下:

DELIMITER $$

CREATE
FUNCTION `t_girl` . `func_rand_string` ( f_num tinyint unsigned , f_type tinyint unsigned )
RETURNS varchar ( 32)
BEGIN
-- Translate the number to letter.
-- No 1 stands for string only.
-- No 2 stands for number only.
-- No 3 stands for combination of the above.
declare i int unsigned default 0;
declare v_result varchar ( 255) default '' ;
while i < f_num do
if f_type = 1 then
set v_result = concat ( v_result, char ( 97+ ceil( rand ( ) * 25) ) ) ;
elseif f_type= 2 then
set v_result = concat ( v_result, char ( 48+ ceil( rand ( ) * 9) ) ) ;
elseif f_type= 3 then
set v_result = concat ( v_result, substring ( replace ( uuid ( ) , '-' , '' ) , i+ 1, 1) ) ;
end if;
set i = i + 1;
end while;
return v_result;

END $ $

DELIMITER ;

調(diào)用方法示例:
復(fù)制代碼 代碼如下:

select func_rand_string(12,3);
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 稻城县| 卢湾区| 镇原县| 仁怀市| 安新县| 黄大仙区| 紫金县| 青田县| 高碑店市| 潮州市| 星座| 固安县| 新乡市| 柳州市| 宁强县| 舒兰市| 新和县| 巴塘县| 兰溪市| 达孜县| 潞城市| 佛教| 冀州市| 疏附县| 阿城市| 伊春市| 富源县| 蒲江县| 射阳县| 洛扎县| 浪卡子县| 长顺县| 平乐县| 滁州市| 苏尼特右旗| 高雄县| 洞头县| 大余县| 巴中市| 平江县| 克山县|