To test for nulls, use only the comparison conditions IS NULL and IS NOT NULL. Any other comparison with nulls will result in NULL.
Keep in mind that an empty string is equivalent to a NULL literal.
if var = null then -- code end if;Or:
if var = '' then -- code end if;
if var is null then -- code end if;