You are viewing documentation about an older version (1.2.0). View latest version

snowflake.snowpark.functions.when¶

snowflake.snowpark.functions.when(condition: ColumnOrSqlExpr, value: ColumnOrLiteral) → CaseExpr[source]¶

Works like a cascading if-then-else statement. A series of conditions are evaluated in sequence. When a condition evaluates to TRUE, the evaluation stops and the associated result (after THEN) is returned. If none of the conditions evaluate to TRUE, then the result after the optional OTHERWISE is returned, if present; otherwise NULL is returned.

Parameters:
  • condition – A Column expression or SQL text representing the specified condition.

  • value – A Column expression or a literal value, which will be returned if condition is true.