Cursor (databases) - Cursors in XQuery

Cursors in XQuery

The XQuery language allows cursors to be created using the subsequence function.

The format is:

let $displayed-sequence := subsequence($result, $start, $item-count)

Where $result is the result of the initial XQuery, $start is the item number to start and $item-count is the number of items to return.

Equivalently this can also be done using a predicate:

let $displayed-sequence := $result

Where $end is the end sequence.

For complete examples see the XQuery Wikibook.

Read more about this topic:  Cursor (databases)