Skip to content
Advertisement

Returning Null Value – Coalesce and ISNULL

I may be having a brain fog, but if I have below:

COALESCE(NULLIF(Address.Info,''), 'Invalid')

Which gives me the value of invalid for all fields in my info column that have an empty space, if I used ISNULL instead of COALESCE would it give me the same result? I cannot access a sql engine currently so just wanted to sanity check. Thanks!

ISNULL(NULLIF(Address.Info,''), 'Invalid')

Advertisement

Answer

The two expressions should be equivalent in e.g. Oracle, which supports these functions.

Presto does support the standard coalesce(). It does not have isnull function though. See more at https://trino.io/docs/current/functions/conditional.html

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement