mysql调用存储过程出现Illegal mix of collations异常

mysql调用存储过程出现Illegal mix of collations错误

先上存储过程

SQL code


  
DELIMITER $$
CREATE PROCEDURE `proce_test`(admin_name VARCHAR(32))
BEGIN
    SELECT create_time FROM information_schema.TABLES AS t WHERE t.table_name=admin_name LIMIT 1;
END

当我调用它的时候,出现错误

SQL code


  
Query: call proce_test("LOG_ALWW")

Error Code: 1267
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='

经检查,information_schema.TABLES编码为UTF-8,而且,如果我将“SELECT create_time FROM information_schema.TABLES AS t WHERE t.table_name=admin_name LIMIT 1;”改为查询当前数据库里的表(也是utf-8编码)数据时,完全没有问题。

百思不得其解,请大家支支招

CREATE PROCEDURE `proce_test`(admin_name VARCHAR(32) charset utf8)试试

mysql调用存储过程出现Illegal mix of collations异常

相关文章:

你感兴趣的文章:

标签云: