FROM_BASE
All functions > MATH > FROM_BASE
Returns the decimal (base 10) equivalent of a number from a specified base.
Signatures
Returns: The decimal (base 10) equivalent
FROM_BASE(number_string: VARCHAR, base: BIGINT) → BIGINT sql
| 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) |
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
Examples
FeatureQL
SELECT
f1 := FROM_BASE('1010', 2), -- Binary to decimal
f2 := FROM_BASE('777', 8), -- Octal to decimal
f3 := FROM_BASE('FF', 16), -- Hexadecimal to decimal
f4 := FROM_BASE('CAFE', 16) -- Hex word to decimal
;Result
| f1 BIGINT | f2 BIGINT | f3 BIGINT | f4 BIGINT |
|---|---|---|---|
| 10 | 511 | 255 | 51966 |
On this page