替换中文后,操作“ concat”的排序规则非法混合

时间:2018-06-21 02:53:37

标签: mysql utf-8 concat

之前:

set extrainfo =concat('{"from":"carpool","table":"Block",  
"key_field":"b_index","key_value:"',b_index,'","infoid":"',info_id,'",
"code":"0","message":"This trip is valid"}');

运行成功。 我将“这次旅行有效”替换为“旅行符合规范”:

set extrainfo =concat( '{"from":"carpool","table":"Block","key_field":
"b_index","key_value:"',b_index,'","infoid":"',info_id,'",
"code":"0","message":"行程符合规范"}');

告诉我:

(node:30849) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 
`enter code here`Error: ER_CANT_AGGREGATE_NCOLLATIONS: 
`enter code here`Illegal mix of collations for operation 'concat'

你能帮我吗?

1 个答案:

答案 0 :(得分:0)

我更改了代码:

set extrainfo =concat( '{"from":"carpool","table":"Block","key_field":
   "b_index","key_value:"',convert(b_index,char),'","infoid":"',convert(info_id,char),'",
"code":"0","message":"行程符合规范"}');

用convert(b_index,char)替换b_index。效果很好。

相关问题