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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:40:44+00:00 2026-06-12T20:40:44+00:00

id parent_id Name Text 0 ……….. body_text 1 ……….0 text……. . something 2 ……….0

  • 0
id  parent_id  Name         Text
0 ...........  body_text   

1 ..........0  text....... . something

2 ..........0  blank       

3 ..........2  text ........ something

4 ...........  info        

5 ..........4  text ........ something

Who knows how to get the following xml format from the previous hierarchical table:

<?xml version "................."?>
<body_text>
<text>something</text>
<blank>
    <text>something</text>
</blank>
</body_text>
<info>
 <text>some</text>
</info>

The only know how to do part of this is and now that isn’t working either:

select DBMS_XMLGEN.getXML(DBMS_XMLGEN.newcontextfromhierarchy('SELECT level,
XMLElement(evalname(Name), text))
from my_table t
START WITH id_parent is null
CONNECT BY PRIOR id = parent_id'))
 FROM dual
  • 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-12T20:40:46+00:00Added an answer on June 12, 2026 at 8:40 pm

    The query you have provided will give you result you are expecting. You just have a couple of syntactical errors. First. parent_id and id_parent column names have a different position of id in your query. Make them the same. Second. remove last parenthesis ) from XMLElement(evalname(Name), text))

    SQL> set long 300
    
    SQL> create table  t1 (id1,  parent_id,  Name1, Text) as(
      2  select 0, null, 'body_text', null        from dual union all
      3  select 1, 0,    'text',      'something' from dual union all
      4  select 2, 0,    'blank',     null        from dual union all
      5  select 3, 2,    'text' ,     'something' from dual union all
      6  select 4, null, 'info',      null        from dual union all
      7  select 5, 4,    'text',     'something'  from dual
      8  );
    
    Table created
    
    SQL> select DBMS_XMLGEN.getXML(DBMS_XMLGEN.newcontextfromhierarchy('SELECT level,
      2     XMLElement(evalname(Name1), text)
      3    from t1 t
      4    start with parent_id is null
      5    connect by prior id1 = parent_id')) xml
      6   from dual
      7  ;
    
    xml
    --------------------------------------------------------------------------------
    <body_text>
      <text>something</text>
      <blank>
        <text>something</text>
      </blank>
    </body_text>
    <info>
      <text>something</text>
    </info>
    
    SQL>  select '<?xml version="1.0" ?>'
      2     || chr(10)
      3     || DBMS_XMLGEN.getXML(DBMS_XMLGEN.newcontextfromhierarchy('SELECT level,
      4            XMLElement(evalname(Name1), text)
      5          from t1 t
      6          start with parent_id is null
      7          connect by prior id1 = parent_id')) as xml
      8   FROM dual
      9  ;
    
    XML
    --------------------------------------------------------------------------------
    <?xml version="1.0" ?>
    <body_text>
      <text>something</text>
      <blank>
        <text>something</text>
      </blank>
    </body_text>
    <info>
      <text>something</text>
    </info>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table structure: ORGANIZATION_ID | Name | PARENT_ID -------------------------------------------------- 1 |
I have an table structure like this mysql> SELECT id, name, parent_id FROM categories;
I have something like this $SQL = SELECT * FROM profile_comments WHERE name =
From below HTML code I want to get all the text except that in
I have this data in a table, for instance, id name parent parent_id 1
class Node < ActiveRecord::Base attr_accessible :name belongs_to :parent_node, :class_name => Node, :foreign_key => :parent_id
Following on from my query regarding XSLT 1.0 - Concatenate known child nodes, group
I've JSON response from php file. [{ NAME: Kiev }, { NAME: Kiev metro
I have a table discussion of which structure is following: Table name: discussion, Id
I made several input field boxes with the following code: <script type='text/javascript'>//<![CDATA[ $(window).load(function(){ $('.add').click(function(){

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.