An apparatus and method for handling a LET binding used in a WHERE clause
of an XQuery FLWOR expression during an XML pivot join procedure. XPath
steps under a LET binding are identified and marked as bindings. During a
match graph construction phase of the pivot join procedure, the bindings
are linked to a first common non-LET binding ancestor, while traversing
from the bottom up. A location identifier for each binding is truncated
to the location identifier of the first common non-LET binding ancestor
to create a truncated location identifier. The truncated location
identifier is compared to a node identification of a FOR binding of the
XQuery FLWOR expression. A match of the node identifications will qualify
the XML document and the XML document is returned by the XML pivot join
procedure.