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

ParameterTypeRequiredDescription
number_stringVARCHARYesString representation of the number in the source base
baseBIGINTYesThe 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

Examples

Last update at: 2025/10/13 10:23:46