Example 6  Functions

Chapter 2: XML Services

Example 7

tolower, toupper, and normalize-space each have a single parameter. If you omit the parameter when you specify these functions in a relative function call, the current node becomes the implicit parameter. For instance, this example shows a relative function call of tolower, explicitly specifying the parameter:

select xmlextract
('//book[title="Seven Years in Trenton"]//tolower(first-name)', text_doc)
from sample_docs where name_doc='bookstore'
-----------------------------------------------------
joe 

This example of the same query specifies the parameter implicitly:

select xmlextract
('//book[title="Seven Years in Trenton"]//first-name/tolower()', text_doc)
from sample_docs where name_doc='bookstore'
---------------------------------------------
joe 

You can also specify parameters implicitly in relative function calls when the call applies to multiple nodes. For example:

select xmlextract('//book//first-name/tolower()', text_doc)
from sample_docs where name_doc='bookstore'
----------------------------------------------
joemarymarytoni 




Copyright © 2004. Sybase Inc. All rights reserved. Functions

View this book as PDF