Replace CASE for layernotnull by COALESCE