User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the XML, XSLT and XPATH section within the Software Development category of DaniWeb, a massive community of 455,968 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,746 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our XML, XSLT and XPATH advertiser: Programming Forums
Views: 4617 | Replies: 32
Reply
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: Xquery in DB2

  #11  
Dec 10th, 2007
DB2 treats XQuery as a first-class language, allowing users to write Xquery expressions directly rather than requiring that users embed or wrap XQueries in SQL statements. DB2's query engine processes XQueries natively, meaning that it parses, evaluates, and optimizes XQueries without ever translating them into SQL behind the scenes. You can check http://www.ibm.com/developerworks/db...-0603saracco2/ to know how to use several popular SQL/XML expressions to query DB2 XML data XQuery.
Reply With Quote  
Join Date: Sep 2007
Posts: 19
Reputation: s.piyush58 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
s.piyush58 s.piyush58 is offline Offline
Newbie Poster

Re: Xquery in DB2

  #12  
Dec 14th, 2007
Can I use Xquery and SQL both in single query in DB2?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: Xquery in DB2

  #13  
Dec 18th, 2007
Yes, you can write "bilingual" queries that include both XQuery and SQL expressions. DB2 will process and optimize these queries as well. To embed SQL in an XQuery, you use the db2-fn:sqlquery function in place of the db2-fn:xmlcolumn function. The db2 fn:sqlquery function executes an SQL query and returns only the selected data. The SQL query passed to db2-fn:sqlquery must only return XML data; this enables XQuery to further process the result of the SQL query. Please check http://www.ibm.com/developerworks/db...dm-0606nicola/ to know when to use SQL/XML or Xquery to query the XML data.
Reply With Quote  
Join Date: Sep 2007
Posts: 19
Reputation: s.piyush58 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
s.piyush58 s.piyush58 is offline Offline
Newbie Poster

Re: Xquery in DB2

  #14  
Dec 19th, 2007
How to write and execute XQueries in DB2?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: Xquery in DB2

  #15  
Dec 20th, 2007
To execute an XQuery directly in DB2, you must preface the query with the keyword XQuery. This instructs DB2 to invoke its XQuery parser to process your request. You only need to do this if you are using XQuery as the outermost (or top level) language. If you embed XQuery expressions in SQL, you don't need to preface them with the XQuery keyword.
Reply With Quote  
Join Date: Sep 2007
Posts: 19
Reputation: s.piyush58 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
s.piyush58 s.piyush58 is offline Offline
Newbie Poster

Re: Xquery in DB2

  #16  
Dec 21st, 2007
Can I embed XQueries in SQL?
Reply With Quote  
Join Date: Oct 2007
Posts: 31
Reputation: ssahil11 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ssahil11 ssahil11 is offline Offline
Light Poster

Re: Xquery in DB2

  #17  
Dec 21st, 2007
How to validate XML data with a XML schema while inserting XML data?
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: Xquery in DB2

  #18  
Dec 27th, 2007
Originally Posted by ssahil11 View Post
How to validate XML data with a XML schema while inserting XML data?


This is answered in the XML Schema thread. Please refer to that thread.
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: Xquery in DB2

  #19  
Dec 27th, 2007
Originally Posted by s.piyush58 View Post
Can I embed XQueries in SQL?


yes, you can also embed XQueries in SQL. Indeed, DB2 9 features support for standard SQL/XML functions that are frequently used to formulate hybrid queries in which SQL is the outermost (or top-level) language. You can use XMLExists function for this. This function lets you navigate to an element (or other type of node) within your XML document and test for a specific condition. When specified as part of the SQL
WHERE clause, XMLExists restricts the returned results to only those rows that contain an XML document that satisfies your specified condition (where the specified condition evaluates to "true").
Reply With Quote  
Join Date: Oct 2007
Posts: 76
Reputation: dilasing is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dilasing dilasing is offline Offline
Junior Poster in Training

Re: Xquery in DB2

  #20  
Dec 27th, 2007
You can also use XMLQuery function which lets you project XML into the SQL result set returned from your SQL/XML query. It's commonly used to retrieve one or more elements from XML documents. Again, as you might imagine, the XMLQuery function takes an XQuery expression as input.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb XML, XSLT and XPATH Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the XML, XSLT and XPATH Forum

All times are GMT -4. The time now is 9:10 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC