MySQL Forums
Forum List  »  Full-Text Search

[SOLVED] How to pass a hexadecimal value in a binary mask?
Posted by: Yann Kechichian
Date: March 01, 2011 04:47AM

Hi everybody,

Here what I noticed when I try to apply a binary mask to a column :

HEX('abc') >> 8 & 255,
0x616263 >> 8 & 255

displays this result :


We can see the result is 98 for this command : 0x616263 >> 8 & 255
but 103 for this one : HEX('abc') >> 8 & 255

If I understood the documentation, this is because the HEX() function returns the hexadecimal representation of the value. Thus, in reality, this is the integer type value 616263 which is passed to the mask.

Basically, I would like to get each character from a column field. This problem should be resolved if I should have to pass a string, for example :

x'616263' >> 8 & 255 returns the correct value (98).

But I didn't find the solution to do this with a column field from the database.

Does anyone know how to pass a real hexadecimal value (and not the representation) to the mask ?

Thanks a lot for your answers.

Edited 4 time(s). Last edit at 03/02/2011 05:14AM by Yann Kechichian.

Options: ReplyQuote

Written By
[SOLVED] How to pass a hexadecimal value in a binary mask?
March 01, 2011 04:47AM

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.