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 an updating expression, the result of all the return clause evaluations is a list of updates. The xquery-update-constant that contains the FLWOR expression performs the updates after merging them with the updates that are returned by other updating expressions within the xquery-update-constant.

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 can result in errors or unexpected results if parentheses are not used.