Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function

nullif — returns a null value if values are equal

Synopsis

nullif(val1: any, val2: any) -> any

Description

The nullif function returns a null value if its first argument val1 is equal to its second argument val2, otherwise it returns val1.

Examples


# spq
nullif(1, 1)
# input

# expected output
null::int64

# spq
nullif("foo", "bar")
# input

# expected output
"foo"