Learn XQuery |
Home:Learn XQuery:White Papers:ACORD:Search and Inquiry Using Multiple Joins Performing a Search and Inquiry Using Multiple JoinsNow consider a more complicated scenario, one in which we receive a message that contains a party inquiry, but one that also requests information about related objects (tc=204 with InquiryLevel set to 2). A "party" in ACORD terms refers to a generic entity that can be associated to people, organizations or trusts; information like details about person/organization, address, phone and more are all related to a party. In our case, the party inquiry message request looks like this (click here to open the XML document): <tx:TXLife xmlns:tx="http://ACORD.org/Standards/Life/2"> The XQuery handling this request looks very similar to what we have seen before: declare namespace tx = "http://ACORD.org/Standards/Life/2"; This time the code responsible for computing the response needs to join data from two tables in the relational database; we use the GovtID information in the message to select the Party and then join with Person based on PartyKey: declare function example:reply-204($request as element(tx:TXLifeRequest)) as element(tx:TXLifeResponse)? { Once again, note how the XQuery author is only focusing on navigating the various data sources as if they all were native XML structures; the underlying DataDirect XQuery™ engine handles the part of code that deals with relational data by issuing the proper SELECT statements to resolve the join condition to the relational database. What's NextGo to Validating Update Requests to see how you can use DataDirect XQuery™ to validate data prior to updating relational database records. |
New Case StudyGevity produces sales proposals in real time using DataDirect XQuery® . See how Gevity uses DataDirect XQuery® to combine Web service data from SalesForce.com with relational data in Oracle in a pricing engine for HR management. |





