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

首頁 > 數據庫 > MySQL > 正文

MySQL 隨機密碼生成代碼

2024-07-24 12:40:27
字體:
來源:轉載
供稿:網友
晚上有朋友問起,簡單的寫了一個。   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 ;     調用方法示例:   select func_rand_string(12,3);   
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 双牌县| 禹城市| 华容县| 股票| 炉霍县| 汝城县| 临洮县| 奇台县| 蚌埠市| 兰坪| 马鞍山市| 河南省| 略阳县| 天镇县| 台东县| 杂多县| 东平县| 乌兰县| 阜新市| 宜春市| 桂平市| 察哈| 敦煌市| 定日县| 云阳县| 禄丰县| 天津市| 无棣县| 宜黄县| 隆回县| 大厂| 固始县| 萍乡市| 太仓市| 筠连县| 綦江县| 汾西县| 高密市| 乐山市| 抚松县| 辽中县|