If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Doing "LIKE" with xquery..?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-22-08, 10:19
dwouters dwouters is offline
Registered User
 
Join Date: Aug 2008
Posts: 4
Doing "LIKE" with xquery..?

Hey guys. I'd like to use xquery to extract some data from an xml column. I need to filter the records on the content of some tags in the same manner as the standard LIKE clause. Basically, how would I tansform the following query...

PHP Code:
select unitIDXMLQUERY('for $e in $d/dept/employee return $e/name/text()' 
                   
passing  d.deptdoc as "d")
from dept d
where  unitID LIKE 
'WW%' and 
       
XMLEXISTS('$d/dept[@deptID = "V15"]' passing d.deptdoc as "d"); 
so that the deptID ends (or starts or contains) with V15? (Example taken from http://www.ibm.com/developerworks/db...dm-0606nicola/)

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-22-08, 10:55
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
You can use the contains(), starts-with(), and ends-with() XPath functions, I guess.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On