+ All Categories
Home > Software > XQuery Extensions

XQuery Extensions

Date post: 20-Jan-2017
Category:
Upload: aaron-buma
View: 811 times
Download: 0 times
Share this document with a friend
12
XQuery Extensions Presentation by Aaron Buma Development DBA
Transcript
Page 1: XQuery Extensions

XQuery Extensions

Presentation by Aaron BumaDevelopment DBA

Page 2: XQuery Extensions

Session Overview

• Take a look at:– .query ()– .value()– .exists()– .modify()– .nodes()– FLWOR

• See them in action

Page 3: XQuery Extensions

.query() Method

• Extracts XML fragments

Page 4: XQuery Extensions

.value() Method

• Extracts a value(s) from the node, [n] is required

Page 5: XQuery Extensions

.exists() Method

• Determines if node exists, returns a 1 or a 0

Page 6: XQuery Extensions

.modify() Method

• Only works with an UPDATE statement• Updates the XML value in directly in the XML• You can insert, replace and delete:– Nodes, values or attributes

Page 7: XQuery Extensions

Dissecting the .modify() Method

• Syntax:– “replace value of ”+(node location)+“ with (“+value+”)”

• Replace value the first occurrence of “name” nodes, where the category is “PARTS”

• With the value “BOLTS-SHORT”

Page 8: XQuery Extensions

Dissecting the .modify() Method

• Where, for all name nodes with the “category” attribute is “PARTS”

• the node value is “BOLTS”

Page 9: XQuery Extensions

Shredding with .nodes()

• Pull XML/values from an XML Stream like a table• Syntax:– Define a node level– Declare a table and Column Collection

– Reference the ‘columns’ with XQuery

Page 10: XQuery Extensions

FLWOR Expressions

• Used for iterating over XML, aka a “for loop”.– Only For and Return are required

• For - Establishes a variable name for current level• Let – Additional variables• Where – Filtering on any of the defined variables• Order By – Ordering the output set• Return – The format of the output

Page 11: XQuery Extensions

DEMOS

Page 12: XQuery Extensions

Review

• .query, .value(), .exists()• .modify() - Insert, Replace, Delete• Shredding with .nodes()• FLWOR Expressions

Presentation Recording, Slides and Scripts– Available at: http://www.aaronbuma.com/2015/10/xquery-extensions/


Recommended