Loading

parse_units

Scalar function

Converts human-readable token amounts to UINT256 raw values by multiplying by 10^decimals.

Overloads

parse_units(VARCHAR)

Parse a decimal string to UINT256 with 18 decimals (ETH-style).

Parameters

Name Type
value VARCHAR

Returns

Name Type
raw_amount UINT256
1
SELECT parse_units('420.5'); -- 420500000000000000000
Notebook ready in readonly mode.

parse_units(VARCHAR, INTEGER)

Parse a decimal string to UINT256 with custom decimals.

Parameters

Name Type
value VARCHAR
decimals INTEGER

Returns

Name Type
raw_amount UINT256
1
SELECT parse_units('100.5', 6); -- 100500000
Notebook ready in readonly mode.

parse_units(VARCHAR, UTINYINT)

Parse a double to UINT256 with 18 decimals. Uses string conversion internally.

Parameters

Name Type
value VARCHAR
arg2 UTINYINT

Returns

Name Type
raw_amount UINT256
1
SELECT parse_units(0.5); -- 500000000000000000
Notebook ready in readonly mode.

parse_units(VARCHAR, UINT8)

Parse a double to UINT256 with custom decimals.

Parameters

Name Type
value VARCHAR
decimals UINT8

Returns

Name Type
raw_amount UINT256
1
SELECT parse_units(0.5, 6); -- 500000
Notebook ready in readonly mode.

parse_units(DOUBLE)

Parse an integer to UINT256 with 18 decimals.

Parameters

Name Type
value DOUBLE

Returns

Name Type
raw_amount UINT256
1
SELECT parse_units(100); -- 100000000000000000000
Notebook ready in readonly mode.

parse_units(DOUBLE, INTEGER)

Parse an integer to UINT256 with custom decimals.

Parameters

Name Type
value DOUBLE
decimals INTEGER

Returns

Name Type
raw_amount UINT256
1
SELECT parse_units(10000, 6); -- 10000000000
Notebook ready in readonly mode.

parse_units(DOUBLE, UTINYINT)

Parameters

Name Type
arg1 DOUBLE
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(DOUBLE, UINT8)

Parameters

Name Type
arg1 DOUBLE
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(FLOAT)

Parameters

Name Type
arg1 FLOAT

Returns

Name Type
result UINT256

parse_units(FLOAT, INTEGER)

Parameters

Name Type
arg1 FLOAT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(FLOAT, UTINYINT)

Parameters

Name Type
arg1 FLOAT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(FLOAT, UINT8)

Parameters

Name Type
arg1 FLOAT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(TINYINT)

Parameters

Name Type
arg1 TINYINT

Returns

Name Type
result UINT256

parse_units(TINYINT, INTEGER)

Parameters

Name Type
arg1 TINYINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(TINYINT, UTINYINT)

Parameters

Name Type
arg1 TINYINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(TINYINT, UINT8)

Parameters

Name Type
arg1 TINYINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(SMALLINT)

Parameters

Name Type
arg1 SMALLINT

Returns

Name Type
result UINT256

parse_units(SMALLINT, INTEGER)

Parameters

Name Type
arg1 SMALLINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(SMALLINT, UTINYINT)

Parameters

Name Type
arg1 SMALLINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(SMALLINT, UINT8)

Parameters

Name Type
arg1 SMALLINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(INTEGER)

Parameters

Name Type
arg1 INTEGER

Returns

Name Type
result UINT256

parse_units(INTEGER, INTEGER)

Parameters

Name Type
arg1 INTEGER
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(INTEGER, UTINYINT)

Parameters

Name Type
arg1 INTEGER
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(INTEGER, UINT8)

Parameters

Name Type
arg1 INTEGER
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(BIGINT)

Parameters

Name Type
arg1 BIGINT

Returns

Name Type
result UINT256

parse_units(BIGINT, INTEGER)

Parameters

Name Type
arg1 BIGINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(BIGINT, UTINYINT)

Parameters

Name Type
arg1 BIGINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(BIGINT, UINT8)

Parameters

Name Type
arg1 BIGINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(HUGEINT)

Parameters

Name Type
arg1 HUGEINT

Returns

Name Type
result UINT256

parse_units(HUGEINT, INTEGER)

Parameters

Name Type
arg1 HUGEINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(HUGEINT, UTINYINT)

Parameters

Name Type
arg1 HUGEINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(HUGEINT, UINT8)

Parameters

Name Type
arg1 HUGEINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(UTINYINT)

Parameters

Name Type
arg1 UTINYINT

Returns

Name Type
result UINT256

parse_units(UTINYINT, INTEGER)

Parameters

Name Type
arg1 UTINYINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(UTINYINT, UTINYINT)

Parameters

Name Type
arg1 UTINYINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(UTINYINT, UINT8)

Parameters

Name Type
arg1 UTINYINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(USMALLINT)

Parameters

Name Type
arg1 USMALLINT

Returns

Name Type
result UINT256

parse_units(USMALLINT, INTEGER)

Parameters

Name Type
arg1 USMALLINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(USMALLINT, UTINYINT)

Parameters

Name Type
arg1 USMALLINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(USMALLINT, UINT8)

Parameters

Name Type
arg1 USMALLINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(UINTEGER)

Parameters

Name Type
arg1 UINTEGER

Returns

Name Type
result UINT256

parse_units(UINTEGER, INTEGER)

Parameters

Name Type
arg1 UINTEGER
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(UINTEGER, UTINYINT)

Parameters

Name Type
arg1 UINTEGER
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(UINTEGER, UINT8)

Parameters

Name Type
arg1 UINTEGER
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(UBIGINT)

Parameters

Name Type
arg1 UBIGINT

Returns

Name Type
result UINT256

parse_units(UBIGINT, INTEGER)

Parameters

Name Type
arg1 UBIGINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(UBIGINT, UTINYINT)

Parameters

Name Type
arg1 UBIGINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(UBIGINT, UINT8)

Parameters

Name Type
arg1 UBIGINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(UHUGEINT)

Parameters

Name Type
arg1 UHUGEINT

Returns

Name Type
result UINT256

parse_units(UHUGEINT, INTEGER)

Parameters

Name Type
arg1 UHUGEINT
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(UHUGEINT, UTINYINT)

Parameters

Name Type
arg1 UHUGEINT
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(UHUGEINT, UINT8)

Parameters

Name Type
arg1 UHUGEINT
arg2 UINT8

Returns

Name Type
result UINT256

parse_units(UINT256)

Parameters

Name Type
arg1 UINT256

Returns

Name Type
result UINT256

parse_units(UINT256, INTEGER)

Parameters

Name Type
arg1 UINT256
arg2 INTEGER

Returns

Name Type
result UINT256

parse_units(UINT256, UTINYINT)

Parameters

Name Type
arg1 UINT256
arg2 UTINYINT

Returns

Name Type
result UINT256

parse_units(UINT256, UINT8)

Parameters

Name Type
arg1 UINT256
arg2 UINT8

Returns

Name Type
result UINT256