Documente Academic
Documente Profesional
Documente Cultură
• Sequence index
Element_name[index] can select element node of selected index number. The index
number starts from 1.
• -- XPath to select all titles element
/book/authors/author[1]
/book/authors/author[2]
/book/authors/author[3]
• To retrieve :
xquery for $x in db2-
fn:xmlcolumn('BOOK.BOOK_INFO')/book/language/text() order by $x
descending return $x
UPDATE BOOK
SET BOOK_INFO = XMLQUERY(
'copy $n:=$BOOK_INFO
modify do insert <language>English</language>
after $n/book/title return $n')
WHERE BOOK_ID = 1
• To retrieve:
xquery for $x in db2-fn:xmlcolumn('BOOK.BOOK_INFO')
where $x/book/fn:data(@isbn-10)="1234567890"
return
<result>{$x/book/title/text()}</result>