return clauses
A return clause generates the result of the FLWOR expression.
The return clause is evaluated once for each tuple of variable bindings that is generated by the other clauses of the FLWOR expression. The order in which tuples of bound variables are processed by the return clause is non-deterministic unless the FLWOR expression contains an order by clause.
If the expression in the return clause is a non-updating expression, the results of all the return clause evaluations are concatenated to form the result of the non-updating FLWOR expression.
If the expression in the return clause
is an updating expression, the result of all the return clause
evaluations is a list of updates. The transform expression that contains
the FLWOR expression performs the updates after merging them with
updates returned by other updating expressions within the modify clause
of the transform expression.
Tip: In return clauses,
use parentheses to enclose expressions that contain top-level comma
operators. Because FLWOR expressions have a higher precedence than
the comma operator, expressions that contain top-level comma operators
could result in errors or unexpected results if parentheses are not
used.