NULLIF

Conditional Function

Description

The NULLIF expression compares two arguments and returns null if the arguments are equal. If they are not equal, the first argument is returned. In Redshift, NULLIF ignores trailing blanks when comparing string values in certain scenarios. As a result, the behavior may differ between Redshift and Snowflake. For this reason, in the transformation RTRIM will add for get the equivalence between Redshift and Snowflake (Redshift SQL Language Reference NULLIF function)

Grammar Syntax

NULLIF ( expression1, expression2 )

This function is fully supported by Snowflake.

Sample Source Patterns

Input Code:

IN -> Redshift_01.sql
SELECT NULLIF('first', 'second') AS different, NULLIF('first', 'first') AS same;

Output Code:

OUT -> Redshift_01.sql
SELECT NULLIF(RTRIM('first'), RTRIM('second')) AS different, NULLIF(RTRIM('first'), RTRIM('first')) AS same;

Known Issues

There are no known issues.

There are no known EWIs.

Last updated