conditional.asciidoc 853 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[sql-functions-conditional]]
  4. === Conditional Functions
  5. Functions that return one of their arguments by evaluating in an if-else manner.
  6. [[sql-functions-conditional-coalesce]]
  7. ==== `COALESCE`
  8. .Synopsis
  9. [source, sql]
  10. ----
  11. COALESCE ( expression<1>, expression<2>, ... )
  12. ----
  13. *Input*:
  14. <1> 1st expression
  15. <2> 2nd expression
  16. ...
  17. **N**th expression
  18. COALESCE can take an arbitrary number of arguments.
  19. *Output*: one of the expressions or `null`
  20. .Description
  21. Returns the first of its arguments that is not null.
  22. If all arguments are null, then it returns `null`.
  23. ["source","sql",subs="attributes,callouts,macros"]
  24. ----
  25. include-tagged::{sql-specs}/docs.csv-spec[coalesceReturnNonNull]
  26. ----
  27. ["source","sql",subs="attributes,callouts,macros"]
  28. ----
  29. include-tagged::{sql-specs}/docs.csv-spec[coalesceReturnNull]
  30. ----