I need to specify COLLATE in connection with LIKE inside a prepared statement inside a stored procedure, e.g. <col> LIKE ? COLLATE utf8_unicode_ci
. I'm getting the following error:
COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'binary'
I have also tried to cast the parameter by all of: LIKE _utf8 ? COLLATE utf8_unicode_ci
, LIKE CONVERT(? AS utf8) COLLATE utf8_unicode_ci
and LIKE CAST(? AS varchar CHARACTER SET utf8) COLLATE utf8_unicode_ci
but the error is then something like:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar CHARACTER SET utf8) COLLATE utf8_unicode_ci ...
Any hint would be greatly appreciated.