Standard Library
XTDB provides a rich standard library of predicates and functions:
- Predicates
- Numeric functions
- String functions
- Temporal functions
- Aggregate functions
- Other functions
The following control structures are available in XTDB:
CASE takes two forms:
-
With a
test-expr,CASEtests the result of thetest-expragainst each of thevalue-expr`s until a match is found - it then returns the value of the corresponding `result-expr.CASE <test-expr>WHEN <value-expr> THEN <result-expr>[ WHEN ... ][ ELSE <default-expr> ]ENDIf no match is found, and a
default-expris present, it will return the value of that expression, otherwise it will return null. -
With a series of predicates,
CASEchecks the value of eachpredicateexpression in turn, until one is true - it then returns the value of the correspondingresult-expr.CASEWHEN <predicate> THEN <result-expr>[ WHEN ... ][ ELSE <default-expr> ]ENDIf none of the predicates return true, and a
default-expris present, it will return the value of that expression, otherwise it will return null.
COALESCE / NULLIF
Section titled “COALESCE / NULLIF”COALESCE returns the first non-null value of its arguments:
COALESCE(<expr>, ...)NULLIF returns null if expr1 equals expr2; otherwise it returns the value of expr1.
NULLIF(<expr1>, <expr2>)