> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EQUAL_NULL

> Compares two values with NULL-safe equality.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns TRUE when both inputs are NULL; FALSE when exactly one is NULL. The result is non-NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
equal_null(value1, value2)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value1 | BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT | Yes | First value to compare. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |
| value2 | BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT | Yes | Second value to compare. Must convert to the same SQL type as the other arguments in this comparison or result branch. Use explicit CAST when mixing types. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |

## Returns

* Type: BOOLEAN
* Possible values: TRUE or FALSE.
* NULL behavior: Returns TRUE when both inputs are NULL; FALSE when exactly one is NULL. The result is non-NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* Non-NULL arguments are compared after compatible comparison type conversion.
* The SQL comparison `IS NOT DISTINCT FROM` uses the same NULL-safe equality rules.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT equal_null(CAST(NULL AS INT), CAST(NULL AS INT)) AS both_null, equal_null(CAST(NULL AS INT), 1) AS one_null;
```

| both\_null | one\_null |
| - | - |
| true | false |

### Compare string values and NULL

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT equal_null('red', 'red') AS equal_strings, equal_null('red', CAST(NULL AS VARCHAR)) AS one_null, equal_null(CAST(NULL AS VARCHAR), CAST(NULL AS VARCHAR)) AS both_null;
```

| equal\_strings | one\_null | both\_null |
| - | - | - |
| true | false | true |

## Related functions

* [nullif](/query/sql/functions/conditional/nullif)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.