## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> NULLIF[NULLIF]:::quoted
NULLIF --> End((END))
```
## Purpose
The `NULLIF` SQL function returns `null` when its two arguments are equal, and the first argument otherwise. `nullif(a, b)` is the same as `case when a = b then null else a end`, as the SQL standard defines it.
The arguments are compared as the comparison operator `=` compares them, so `nullif(1, 1.0)` is `null`. When one of the arguments is `null`, the comparison is unknown and the first argument is returned: `nullif(1, null)` is `1`. The empty text has `null` semantics on Invantive UniversalSQL.
Available from release 28.0.
See also [[NVL]] and [[COALESCE]].
Parameters:
- Position 1 (`ANY`): the value to return.
- Position 2 (`ANY`): the value for which `null` is returned instead.
A call with another number of arguments raises `itgenttn523`.
Returns: `null` when both arguments are equal, otherwise the first argument, in its data type.
## Examples
The following example returns `null`, since both arguments are equal:
```sql
select nullif(1, 1)
-------------------
```
The following example returns the first argument, since the arguments differ:
```sql
select nullif('a', 'b')
-------------------
a
```
The following example avoids a division by zero by dividing by `null` instead:
```sql
select 100 / nullif(0, 0)
-------------------
```