delimiter $$
CREATE PROCEDURE create_password2()
BEGIN
declare s varchar(62) default 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
DECLARE n,r1,r2,r3,r4,r5,r6 INT DEFAULT 1;
DECLARE str varchar(255) default '';
set r1=floor(1+rand()*3);
while r1<63
do

 set r2=floor(1+rand()*3);
 while r2<63
 do 
   set r3=floor(1+rand()*3);
   while r3<63
   do
     set r4=floor(1+rand()*3); 
     while r4<63
     do 
       set r5=floor(1+rand()*3);
       while r5<63
       do
         set r6=floor(1+rand()*3); 
         while r6<63
         do 
           set str=concat(substring(s,r1,1) ,substring(s,r2,1) ,substring(s,r3,1) ,substring(s,r4,1) ,substring(s,r5,1) ,substring(s,r6,1) );
           INSERT INTO dgq_password(password_clear,password_sha1) VALUES(str,password(str));
         set r6=r6+4;
         end while;
       set r5=r5+4;
       end while;
     set r4=r4+4;
     end while;
   set r3=r3+4;
   end while;
 set r2=r2+4;
 end while;

set r1=r1+3;
end while;

END$$
DELIMITER ;

标签: mysql

评论已关闭