ORA-XQ-246-C: add more examples explaining why "let $i:= $i +1" is unintuitive in XQuery

SECTION 3.1.2: Variable References

Consider the following query:
for $j in (1,2) let $i:= $i +1 return <foo>{$i}</foo>

This  raises a dynamic error because the $i on the right is not
bound yet. This is based on 3.8 Flwor expression rule
on variable scope: "The scope does not include 
the expression to which the variable is bound".
However, this is counter-intutive for users
who are used to procedural programming
and now work on XQuery which is a functional language.

It would be better to list this as an example to explain why
the variable reference of $i on the right results in dynamic errors.


- Steve B.

Received on Monday, 16 February 2004 17:16:04 UTC