XQuery TutorialLesson 74Free preview
XQuery Functions
This lesson is part of XML · All levels
Summary
XQuery has many built-in functions in the namespace fn: such as fn:count(), fn:concat(), fn:upper-case(), and fn:current-dateTime(). You can also define the function itself by declaring function in the prologue, complete with the type of parameter and the type of result. The homemade function makes complex queries more concise and easy to test.
Key points
- The default namespace of the built-in function is fn:
- Example of an inbuilt function: count(), concat(), upper-case(), not(), current-date()
- Artificial function: declare function prefix:nama($a as xs:type) as xs:type {...};
- A body of functions contains an expression that returns a value
- Prefix other than fn: free to use provided it is declared in the prologue
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.