Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7028075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:20:17+00:00 2026-05-28T00:20:17+00:00

hope this is something simple and I am just missing it, but consider this

  • 0

hope this is something simple and I am just missing it, but consider this example:

with et as(
     SELECT 
           xmlType('<Invoice>
    <InvoiceInformation>
        <Number>123456</Number>
    </InvoiceInformation>
    <InvoiceLines>
        <InvoiceLine>
            <Detail>
                <Amount>100</Amount>
                <Line>1</Line>
            </Detail>
            <Type>
                <CheesyPotato>
                    <Instructions>
                        <CookTime>120</CookTime>
                        <CookTimeUnits>Minutes</CookTimeUnits>
                        <CookTemperature>450</CookTemperature>
                    </Instructions>
                </CheesyPotato>
            </Type>
        </InvoiceLine>
        <InvoiceLine>
            <Detail>
                <Amount>10000</Amount>
                <Line>2</Line>
            </Detail>
            <Type>
                <DeathStar>
                    <Instructions>
                        <CookTime>4</CookTime>
                        <CookTimeUnits>5 "parsecs"</CookTimeUnits>
                        <CookTemperature>1000000</CookTemperature>
                    </Instructions>
                </DeathStar>
            </Type>
        </InvoiceLine>  
        <InvoiceLine>
            <Detail>
                <Amount>250</Amount>
                <Line>3</Line>
            </Detail>
            <Type>
                <Quiche>
                    <Instructions>
                        <CookTime>75</CookTime>
                        <CookTimeUnits>Minutes</CookTimeUnits>
                        <CookTemperature>350</CookTemperature>
                    </Instructions>
                </Quiche>
            </Type>      
        </InvoiceLine>    
    </InvoiceLines>  
</Invoice>  
 ') xt
      from dual
       ) 
        SELECT     
            ext.*
           FROM
           et,
           XMLTABLE(
           'for $Invoice in $INV/Invoice
                for $InvoiceItem in $Invoice/InvoiceLines/InvoiceLine
                  return <row> 
                  {
                    $Invoice
                    ,$InvoiceItem
                  } 
                  </row>'           
              PASSING et.xt as INV
                    COLUMNS
               INVOICENUMBER                   VARCHAR2  (6)       PATH 'Invoice/InvoiceInformation/Number'                    
              ,InvoiceLineNumber               VARCHAR2  (5)       PATH 'InvoiceLine/Detail/Line'
              ,Amount                          VARCHAR2  (5)       PATH 'InvoiceLine/Detail/Amount'
              ,CookTime                        VARCHAR2  (5)       PATH 'InvoiceLine/Type//Instructions/CookTime'
              ,CookTimeUnits                   VARCHAR2  (15)       PATH 'InvoiceLine/Type//Instructions/CookTimeUnits'
              ,CookTemperature                 VARCHAR2  (10)       PATH 'InvoiceLine/Type//Instructions/CookTemperature'
            ) ext
/            

–Give me these results

    INVOICENUMBER INVOICELINENUMBER AMOUNT COOKTIME COOKTIMEUNITS   COOKTEMPERATURE 
------------- ----------------- ------ -------- --------------- --------------- 
123456        1                 100    120      Minutes         450             
123456        2                 10000  4        5 "parsecs"     1000000         
123456        3                 250    75       Minutes         350

However I would like to, in this query, get the Type value. Thus How do I get the child node of Type’s “Name” so my results would be as such?

TypeChild       INVOICENUMBER INVOICELINENUMBER AMOUNT COOKTIME COOKTIMEUNITS   COOKTEMPERATURE 
------------------- ------------- ----------------- ------ -------- --------------- --------------- 
CheesyPotato    123456        1                 100    120      Minutes         450             
DeathStar       123456        2                 10000  4        5 "parsecs"     1000000         
Quiche          123456        3                 250    75       Minutes         350

I have tried various methods; along the lines of “,$InvoiceItem/Type/child/name” to no avail, any help would be appreciated, thanks

Or am I simply going at this the incorrect way? (what cannot be changed, however, is that I will need to be able to consume this XML into a query!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:20:18+00:00Added an answer on May 28, 2026 at 12:20 am
    ,TypeChild  VARCHAR2(15)  PATH  'InvoiceLine/Type/*/name()'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope this question takes a simple fix, and I am just missing something
I'm an actionscript novice so I hope I'm missing something simple here. In a
I'm struggling with something quite simple, but I'm going around in circles, and just
This is just my simple way of making a many to many relationship, but
I hope this is something straightforward that I'm doing wrong. I saw something online
hope to get some help here because this is something that really makes me
Hope this makes sense... Is there a simple way to return a set of
I hope this question is not considered too basic for this forum, but we'll
I hope this question isn't too simple, I tried to go through the postgresql
This seems to me like a very simple question, but I can't seem to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.