IF
Executes the first sql_statement_list where the condition is true, or the optional ELSE sql_statement_list if no conditions match.
Grammar Syntax
IF condition THEN [sql_statement_list]
[ELSEIF condition THEN sql_statement_list]
[...]
[ELSE sql_statement_list]
END IF;
Click here to go to the BigQuery specification for this syntax.
The grammar is fully supported by Snowflake. The only difference is that in Snowflake it is required to add parentheses to the different conditions.
Sample Source Patterns
CREATE OR REPLACE PROCEDURE test.proc1(intParam INT64, OUT message STRING)
BEGIN
IF intParam = 0 THEN
SET message = 'The value is zero.';
ELSEIF intParam = 1 THEN
SET message = 'The value is one.';
ELSE
SET message = 'The value is not zero or one.';
END IF;
END;
Last updated
Was this helpful?