0x00
level: 0x02
0x01
code:
-- 删除 DROP FUNCTION IF EXISTS get_varchar_test; -- 创建 CREATE FUNCTION get_varchar_test(_id INT) RETURNS VARCHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ciBEGIN DECLARE content VARCHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci; # t_na 值为 '中文ab' SELECT t_na INTO content FROM t1 WHERE t_id = _id; RETURN content; END; -- 测试SELECT get_varchar_test(1);
0x02
ps: 给VARCHAR设置字符集就可以了