Skip to main content

CONV

Description​

Do radix conversion for input parameter.

Syntax​

CONV(<input>, <from_base>, <to_base>)

Parameters​

ParameterDescription
<input>Parameters to be converted, either as strings or integers
<from_base>Numeric, the source base, within [2,36].
<to_base>Numeric, the target base, within [2,36].

Return Value​

The number under the converted target binary <to_base> is returned as a string.

Examples​

SELECT CONV(15,10,2);
+-----------------+
| conv(15, 10, 2) |
+-----------------+
| 1111 |
+-----------------+
SELECT CONV('ff',16,10);
+--------------------+
| conv('ff', 16, 10) |
+--------------------+
| 255 |
+--------------------+
SELECT CONV(230,10,16);
+-------------------+
| conv(230, 10, 16) |
+-------------------+
| E6 |
+-------------------+