语句
SET @orderCode = "xxx";
SELECT * from order where code = @orderCode;
异常:
Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (latin1_swedish_ci,NUMERIC)
执行
SHOW VARIABLES LIKE 'coll%';
sql结果
将之前的sql改为
SET collation_connection = 'utf8mb4_general_ci';
SET @orderCode = "xxx";
SELECT * from order where code = @orderCode;
或者修改全局的collation_connection