I have a very strange situation with a couple of procedures in my project. Both do the same (see below) but on different tables, so I'll explain the issue (same in both procedures).
I have a table hosting hundreds of labels that need to be returned to a client. The response is always sent as TEXT. Initially, the procedure would select from the relevant table, perform the required concatenation, and send the string back.
I made a simple (or so I thought) change that would store the result into a DIGEST table. So, when the same function is invoked the second time, it would first check if there is an applicable response available within the digest table and, if yes, just return the response. If there is no matching entry in the digest, build the response, store it within the digest table (for next invocation) and return the built response.
The functions work perfectly if I always build (concatenate) the response and return it. If, on the other hand, I extract the response from the digest table, I get the error Error Code: 1366. Incorrect string value: '\xF0K\xF59{z...'.
I checked the contents of the digest table and it looks OK.
Any idea where the issue might come from?
Thanks in advance for any suggestion.