FROM_BASE()

All functions > MATH > FROM_BASE()

Returns the decimal (base 10) equivalent of a number expressed in a specified base.

Signatures

From base

Returns: Decimal equivalent

FROM_BASE(number_string: VARCHAR, base: B) → BIGINT
sql
ParameterTypeRequiredDescription
number_stringVARCHARYesString representation of the number in the source base
baseBYesSource base, from 2 to 36

With:

  • B : Integer type (TINYINT … BIGINT)

Signature notes:

  • Supports bases from 2 (binary) to 36
  • For bases > 10, uses letters A-Z for digits 10-35, case insensitive
  • Returns NULL if number_string is NULL or invalid

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 BIGINTf2 BIGINTf3 BIGINTf4 BIGINT
1051125551966

Last update at: 2026/05/26 17:22:09