try_sub

Subtracts two UINT256 values. Arithmetic underflow produces NULL; independently, ordinary scalar NULL propagation produces NULL when either input is NULL.

Scalar function TypesEVM

Example

Runs locally

SELECT try_sub(5::UINT256, 8::UINT256)::VARCHAR AS result;
-- => [{"result":null}]

API reference

try_sub(UINT256, UINT256) #

Returns a - b when a >= b, otherwise NULL.

Inputs

Name Type Use
a UINT256

UINT256 value from which b is subtracted.

required positional
b UINT256

UINT256 value subtracted from a.

required positional

Returns

Name Type
difference UINT256

Checked difference. UINT256 difference, or NULL for arithmetic underflow or an input NULL.