MariaDB 存储过程返回 汉字问题
创建代码如下:
CREATE DEFINER=root
@localhost
PROCEDURE test
(IN id
INT, OUT result
VARCHAR(50))
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT "
BEGIN
if id = 1 then
set result = '红字';
else
set result = 'ghj';
end if;
END
set names utf8;
set @a=";
CALL test
(0, @a);
select @a;
没有问题;
set names utf8;
set @a=";
CALL test
(1, @a);
select @a;
报错!
运行总是无法成功返回汉字,郁闷
——解决方案——————--
create procedure t ( aa char(10) charset 'gbk')
from:http://www.myexception.cn/mysql/744652.html