• 游标的使用


    CREATE DEFINER PROCEDURE `updaterole_20171127`()
    begin
    DROP TEMPORARY TABLE IF EXISTS tmppassword;
    create temporary table if not exists tmppassword
    (
    tabname varchar(50),
    PhonePassword text
    );
    BEGIN
    declare v_gameid int(11);
    declare done INT(3) DEFAULT 0;
    declare v_name1 varchar(100);

    DECLARE rs CURSOR FOR select table_name from information_schema.tables
    where table_schema='zzzjh' and table_name like 'Player%' order by table_name;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1 ;

    OPEN rs;
    REPEAT
    FETCH rs INTO v_name1;
    IF done = 0 THEN
    set @sql11="DELETE from tmppassword";
    PREPARE stmt FROM @sql11;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
    set @sql1=concat(' insert into tmppassword(tabname,PhonePassword) select ''',v_name1,''',PhonePassword from ',v_name1,' where Nick like ''游客%'' and Phone is NOT NULL and Gold=0 ',
    'and RegisterSP=''guanfang'' group by PhonePassword having count(1)>=5');
    PREPARE stmt FROM @sql1;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
    set @sql12=concat('update ',v_name1,' set Gold=0,Score=0,PhonePassword=''96E79218805EB72C92A589DD5A330119''
    where PhonePassword in(select PhonePassword from tmppassword) and Nick like ''游客%'' and Phone is NOT NULL and Gold=0
    and RegisterSP=''guanfang''');
    PREPARE stmt FROM @sql12;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
    set @sql13=concat('update ',v_name1,' set Gold=0,Score=0,PhonePassword=''96E79218805EB72C92A589DD5A330119''
    where (RegisterMachine=''XXEmulator'' or NowMachine=''XXEmulator'')
    and Phone is not null');
    PREPARE stmt FROM @sql13;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
    END IF;
    UNTIL done END REPEAT;
    CLOSE rs;
    END;

    end

  • 相关阅读:
    详解MathType中如何插入特殊符号
    详解如何将MathType嵌入word中
    MathType公式编辑器快捷键操作
    MathType初级教程:怎么安装MathType
    AOPR密码过滤器
    教您如何在Word的mathtype加载项中修改章节号
    在word文档中如何插入Mathtype公式
    详解MathType中如何更改公式颜色
    静态缓存和动态缓存
    ThinkPHP U函数生成URL伪静态
  • 原文地址:https://www.cnblogs.com/playforever/p/7928048.html
Copyright © 2020-2023  润新知