zoukankan      html  css  js  c++  java
  • 一秒钟解决mysql使用游标出现取值乱码问题

    drop procedure if exists pro_test;
    delimiter //
    create procedure pro_test()
    begin
      declare str varchar(256) character set utf8 ; #指定变量 的字符集 为 utf8 
      declare str_str varchar(256) character set utf8 default ''; 
      declare done int default 0;
      declare c_person cursor for select title from t_score;
      declare continue handler for not found set done = 1;
      open c_person;
      xxx:loop
        fetch c_person into str;
        if done = 1 then
          leave xxx;
        end if;
        set str_str = concat(str_str,concat(str,'/'));
      end loop;
      select  str_str;
      close c_person;
    end //
    delimiter ;
    call  pro_test();
    
    在变量后指定一个字符集( character set utf8 )。这样就可以了。
    

      

  • 相关阅读:
    TCP/IP||ARP/RARP
    TCP/IP||IP
    TCP/IP||链路层
    Struts||IQ
    SpringMVC||IQ
    TCP/IP Basic
    Spring||Mails
    Spring||Quartz
    jQuery Ajax 方法应用。
    html5的离线储存应用.
  • 原文地址:https://www.cnblogs.com/oukele/p/9676547.html
Copyright © 2011-2022 走看看