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

fquxozlt  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(373)

之前:

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'

你能帮助我吗?

wtlkbnrh

wtlkbnrh1#

我改了密码:

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\u index,char)替换b\u索引。效果很好。

相关问题