IF STATEMENT

Description

Let you execute alternative commands based on certain conditions.

Click here to navigate to the PostgreSQL documentation page for this syntax.

IF STATEMENT is supported by Snowflake.

Grammar Syntax

IF ... THEN ... END IF

IF ... THEN ... ELSE ... END IF

IF ... THEN ... ELSIF ... THEN ... ELSE ... END IF

Sample Source Patterns

Input

The only changes that are done to the If Statement, are the following

The conditions are enclosed by parenthesis.

ELSIF is changed to ELSEIF.

IF firstValue > secondValue THEN
   RETURN 'fistValue is greater than secondValue';
ELSIF firstValue < secondValue THEN
   RETURN 'fistValue is less than secondValue';
ELSE
   RETURN 'firstValue is equal to secondValue';
END IF;

IF [NOT] FOUND generates an UDF that contains the FOUND keyword logic, replaces the FOUND keyword for a call to that function.

IF FOUND THEN

Known Issues

No known issues.

Last updated