> when ($1 is null and $2 is not null)> or ($1 is not null and $2 is null) then 0
That's the same as:
when $1 is null != $2 is null then 0
Chris