CASE
Description
The
CASE
statement in Redshift lets you return values based on conditions, enabling conditional logic in queries. It has two forms: simple and searched. (Redshift SQL Language Reference Conditionals: Case).
Simple Case
A simple CASE statement provides conditional execution based on equality of operands.
Simple Case are fully supported by Snowflake.
Grammar Syntax
Sample Source Patterns
Input Code:
Output Code:
Searched Case
Searched Case are fully supported by Snowflake.
Grammar Syntax
Sample Source Patterns
Input Code:
Output Code:
CASE Without ELSE
In Redshift, when a CASE
expression is executed and none of the validated conditions are met, and there is no ELSE
defined, the exception 'CASE NOT FOUND' is triggered. In Snowflake, the code executes but returns no result. To maintain the same functionality in Snowflake in this scenario, an exception with the same name will be declared and executed if none of the CASE
conditions are met.
Case Without Else are fully supported by Snowflake.
Input Code:
Output Code:
Known Issues
There are no known issues.
Related EWIs.
There are no related EWIs.
Last updated