# try_add

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

Canonical HTML: <https://determica.com/docs/functions/try_add>

- Kind: scalar function
- Category: [EVM utilities](/docs/category/evm-utilities.md)
- Tags: Types, EVM

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

## Overload 1: try_add(UINT256, UINT256)

```sql
try_add(UINT256, UINT256)
```

Returns a + b when it fits UINT256, otherwise NULL.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `a` (UINT256; required; positional) — UINT256 addend.
- `b` (UINT256; required; positional) — UINT256 addend.

### Returns

Checked sum

UINT256 sum, or NULL for arithmetic overflow or an input NULL.

- `sum` (UINT256)

Checked sum. UINT256 sum, or NULL for arithmetic overflow or an input NULL.

### Examples

_Local SQL · Local_

```sql
SELECT try_add(40::UINT256, 2::UINT256)::VARCHAR AS result;
-- => [{"result":"42"}]
```

## Related functions

- [evm_addmod](/docs/functions/evm_addmod.md) — See Also
- [evm_mulmod](/docs/functions/evm_mulmod.md) — See Also
- [muldiv](/docs/functions/muldiv.md) — See Also
