Apache DERBY XMLQUERY in new rows

Alles, was den Apache betrifft, kann hier besprochen werden.

Apache DERBY XMLQUERY in new rows

Postby zubijaw » 18. October 2015 17:03

I have an xml with beggining like this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<orders>
   <singleOrder no="1" date="2015-01-22">
      <customer id="1" />
      <products>
         <product>
            <productId>1</productId>
            <orderId>1</orderId>
            <quantity>3</quantity>
         </product>
      </products>
   </singleOrder>
   <singleOrder no="4" date="2015-02-27">
      <customer id="1" />
      <products>
         <product>
            <productId>3</productId>
           <orderId>4</orderId>
            <quantity>2</quantity>
         </product>
         <product>
            <productId>4</productId>
           <orderId>4</orderId>
            <quantity>4</quantity>
         </product>
      </products>
   </singleOrder>
</orders>

I inserted this xml to xml_orders table - whole in one table.

When i make query like this:

Code: Select all
SELECT XMLSERIALIZE(
        XMLQUERY('//productId/text()' PASSING BY REF  xml_col RETURNING SEQUENCE EMPTY ON
        EMPTY) AS VARCHAR(10)
    )AS ProductId
FROM xml_orders

I'm getting such a result: 134

How could I get every productId result in new row?
zubijaw
 
Posts: 1
Joined: 18. October 2015 17:01
Operating System: Ubuntu

Re: Apache DERBY XMLQUERY in new rows

Postby Nobbie » 18. October 2015 17:54

zubijaw wrote:How could I get every productId result in new row?


Why do you ask in an Apache Forum??

Apache Derby and Apache are totally different products (only the name is similar). This is a plain Apache forum (NOT Apache Derby).
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 3 guests