Conditional Functions
  # StreamSQL Conditional Functions
Conditional functions are used for conditional judgment and value selection.
# IF_NULL - Null Handling Function
Syntax: if_null(value, default_value)
 Description: If the value is NULL, returns the default value; otherwise returns the original value.
# COALESCE - Coalesce Function
Syntax: coalesce(value1, value2, ...)
 Description: Returns the first non-NULL value.
# NULL_IF - Null Conversion Function
Syntax: null_if(value1, value2)
 Description: If the two values are equal, returns NULL; otherwise returns the first value.
# GREATEST - Greatest Function
Syntax: greatest(value1, value2, ...)
 Description: Returns the maximum value among the parameters.
# LEAST - Least Function
Syntax: least(value1, value2, ...)
 Description: Returns the minimum value among the parameters.
# CASE_WHEN - Conditional Branch Function
Syntax: case_when(condition, value_if_true, value_if_false)
 Description: Returns different values based on the condition.
# 📚 Related Documentation
- Type Check Functions - Learn detailed usage of type check functions
 - Multi-row Functions - Learn detailed usage of multi-row functions
 - SQL Reference - View complete SQL syntax reference
 
Edit this page on GitHub  (opens new window)
  Last Updated: 2025/09/03, 10:09:04