MySQL CONCAT(“string”,longtext) results in hex string

后端 未结 2 1917
轻奢々
轻奢々 2021-01-11 15:16

I\'m experiencing a weird hex string result when trying to concat a string with a column that should be of LONGTEXT type.

The query goes like this:

S         


        
相关标签:
2条回答
  • 2021-01-11 16:02

    When you concat a number without a cast it returns as a blob. This is intended functionality of MySQL as far as I can tell since, it was reported in this bug thread and they closed it and confirmed it was returning a Blob.

    0 讨论(0)
  • 2021-01-11 16:08

    Have you tried casting? Usually works pretty well for me. Example:

    SELECT CONCAT("abc",CAST(t.LONGTEXT_VALUE AS CHAR),"cde") FROM mytable t
    
    0 讨论(0)
提交回复
热议问题