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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -