Conditional Expressions

Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

markdownreferencev1B91B-WS7Pguide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sqlConditional ExpressionsData 360Data CloudData 360 Query Guide

Created 23 Oct 2026 · Modified 23 Oct 2026 · 1 version

Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/conditional-func.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

Conditional Expressions

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Conditional expressions select one of multiple result values. Use conditional expressions to:

  • Branch on conditions to return different results for different cases.
  • Substitute defaults for NULL values or convert specific values to NULL.
  • Select the largest or smallest value from a list of expressions.
  • CASE and COALESCE evaluate only the subexpressions needed to determine the result. GREATEST and LEAST evaluate every argument.
  • The data types of all result values must be convertible to a single output type.

Return different results based on conditions:

  • CASE — Return a result based on the first matching condition or value.
  • IFF — Select an expression based on a Boolean condition; a NULL condition selects the false expression.

Substitute defaults for NULL values or convert values to NULL:

  • COALESCE — Return the first non-NULL argument.
  • NVL and IFNULL — Return a replacement when the first expression is NULL; IFNULL is an alias of NVL.
  • NULLIF — Return NULL when two values are equal.
  • NULLIFZERO — Return NULL when numeric input is zero.
  • ZEROIFNULL — Return zero when numeric input is NULL.

Choose the largest or smallest value from a list:

Read this document as markdown — the same bytes an agent receives.