Re: #HY000Illegal mix of collations for operation 'concat'
Posted by: Reggie Burnett
Date: November 14, 2004 09:06AM


Yes, this syntax will be required but less often. The problem is occuring when a literal (in this case '<fieldvalue>' is the literal) is sent to the server in one charset and compared to a column of another charset. This comparison is happening in your SQL because you are doing "WHERE <field> = '<fieldvalue>'. The driver is using utf-8 to send the SQL over (so the literal is utf-8) but the field it is comparing to is latin1. The reason it works with the CONVERT function is becuase that function is executing on the server and is converting the utf-8 string to latin1 before the comparison.

Once 1.0.2 is out, you can specify what charset the driver should use so if all your tables are using latin1 (for example) you can set latin1 on your connection string and you won't have to use CONVERT() for your SQL.

However, if you ever had columns or tables in your db that used a different charset than the default you specified (maybe your website supports multiple languages and your errors table has messages in several languages) and you needed to do comparisons using that non-default charset, you would have to use CONVERT in that case.

Hope this clears it up.


Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.