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 7938597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:51:12+00:00 2026-06-03T22:51:12+00:00

I have a hierarchical query in Oracle 11g that gets me all my leaf

  • 0

I have a hierarchical query in Oracle 11g that gets me all my leaf nodes out of my tree, and it works great. However, I need to try and capture each part of the path separately while I traverse to my leaf node. Is there some way to do that? either with a modification to my query or a second query??

Any help is really appreciated!

Here is my query:

select c.id, 
   c.superid,
   c.name,
   SYS_CONNECT_BY_PATH(c.name, '>>') as PathName
from mytable c
where c.activestatus =0 AND
  c.id NOT IN(select distinct c2.superid from categorizations c2 where c2.superid IS NOT NULL)
start with c.superid IS NULL
connect by prior c.id = c.superid;

So currently I get an output like:
id, superid, name1, >>name1>>name2>>name3>>name

Which is good. But I’m trying to somehow capture each of the node names (because I need to output it in XML).

So right now my XML for each leaf node looks like

<Node1>
  <Project>name</Project>
  <PathName>>name1>>name2>>name3>>name</PathName>
</Node1>.  

I’d like to somehow be able to get XML that looks like

<Node1>
 <Project>name1
   <Project>name2
      <Project>name3
         <Project>name</Project>
      </Project>
   </Project>
</Project>
<PathName>>name1>>name2>>name3>>name</PathName>
</Node1>

….or something like that, basically I’d like to be able to output my tree hierarchy to XML.

  • 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-06-03T22:51:13+00:00Added an answer on June 3, 2026 at 10:51 pm

    You could use <project> instead of >> prepend another and then use the level pseudo-column to append one </project> per level

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a hierarchical query in Oracle 10 SQL that used to work. However,
I have a hierarchical organization that is a tree where the node is a
I have a hierarchical query to track a reporting structure. This almost works, except
I am trying to query a (large) Oracle 9 table that represents some hierarchical
Hi I have the following Hierarchical Query. May I know how to include the
I have a hierarchical (tree structure) SQL Server table TEmployee with following columns Id
I have a hierarchical table on Oracle pl/sql. something like: create table hierarchical (
I have a highly structured hierarchical directory containing multiple files that need to be
I have a typical SQL Server hierarchical query: WITH bhp AS ( SELECT name,
I have data in a DB that have hierarchical relationship (could be represented as

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.