conv function (Databricks SQL)

Converts num from fromBase to toBase.

Syntax

conv(num, fromBase, toBase)

Arguments

  • num: An STRING expression expressing a number in fromBase.

  • fromBase: An INTEGER expression denoting the source base.

  • toBase: An INTEGER expression denoting the target base.

Returns

A STRING.

The function supports base 2 to base 36. The digit ‘A’ (or ‘a’) represents decimal 10 and ‘Z’ (or ‘z’) represents decimal 35.

Examples

> SELECT conv('100', 2, 10);
 4
> SELECT conv('-10', 16, 10);
 -16