MySQL CONV() Function
Definition and Usage
The CONV() function converts a number from one number base to another, and returns the result as a string value.
Syntax
CONV(number, from_base, to_base)
Parameter Values
Parameter | Description |
---|---|
number | Required. The number to convert |
from_base | The number base of number (must be a number base between 2 and 36) |
to_base | The number base to convert to (must be a number base between 2 and 36 or -2 and -36) |
Note
- CONV() returns NULL if any of the parameters are NULL
- CONV() treats number as an unsigned number if a positive to_base is specified
- CONV() treats number as a signed number if a negative to_base is specified
- CONV(number, 10, 2) is equivalent to using the BIN() function
Technical Details
Works in: | MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23 |
---|
More Examples
Example
Convert a number from one number base to another:
SELECT CONV(1111, 2, 10);
Try it Yourself »
Example
Convert a number from one number base to another:
SELECT CONV(88, 10, 16);
Try it Yourself »