FROM_BASE
All functions > MATH > FROM_BASE
Converts a number from a specified base to decimal (base 10).
Syntax
FROM_BASE(expr, base)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
number_string | VARCHAR | Yes | String representation of the number in the source base |
base | BIGINT | Yes | The base to convert from (2-36) |
Returns
BIGINT - The decimal (base 10) equivalent
Notes
- Supports bases from 2 (binary) to 36
- For bases > 10, uses letters A-Z for digits 10-35
- Case-insensitive for letter digits
- Returns NULL if number_string is NULL or invalid
- Useful for converting binary, octal, hexadecimal numbers