try_sub

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

Example

Local

1
SELECT try_sub(5::UINT256, 8::UINT256)::VARCHAR AS result;
2
-- => [{"result":null}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

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.

Related functions

Category and tags

Category
EVM utilities
Tag
Types
Tag
EVM