sql - Presto check if NULL and return default (NVL analog) -
is there analog of nvl in presto?
i need check if field null , return default value.
i solve somehow this:
select case when my_field null 0 else my_field end my_table
but i'm curious if there simplify code.
my driver version 0.171
the iso sql function coalesce
coalesce(my_field,0)
https://prestodb.io/docs/current/functions/conditional.html
p.s.
coalesce
can used multiple arguments.
return first (from left) non-null argument, or null if not found.
e.g.
coalesce (my_field_1,my_field_2,my_field_3,my_field_4,my_field_5)
Comments
Post a Comment