I have a situation where i need to get the integer value from a literal hex. Example: "ff" equals 255 in decimal, but if i use the HEX("ff") function it returns 6666. Is it possible to get it to return 255? Like a=10, b=11... and so on

Thank you

1 Answer 1


If you need to convert hexadecimal representation to decimal one then you must use CONV() function.

SELECT CONV('ff', 16, 10);
| CONV('ff', 16, 10) |
| :----------------- |
| 255                |

db<>fiddle here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.