• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 739
  • Last Modified:

Oracle - Generation format to Parent / child format hierarchies

Hello Gurus,
I have a hierarchy in generation format and need to convert it to parent / child format.  Does someone have some SQL code to do this?  I'm in a time crunch and this is an unexpected obstacle.  Any help is very much appreciated!

Thanks!
0
Cheryl McCormick
Asked:
Cheryl McCormick
  • 5
  • 4
1 Solution
 
sdstuberCommented:
do you have sample data and expected output?
0
 
Cheryl McCormickConsultantAuthor Commented:
Please see attached.  Expected format is parent / child.

Thanks for such a quick reply!
Sample-GEN-Data.xls
0
 
sdstuberCommented:
what do you mean by "parent /child" format?

2 tables with an index between them?

hierarchical results sorted by parents?

something else?

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Cheryl McCormickConsultantAuthor Commented:
I need to create a table that shows the parent value in one column and the child value in the second column.  Based on the same it would look like this:

PARENT Col                                  CHILD Col
STRPNL                                         NETCON
NETCON                                        TOTCON
NETCON                                        NONSTR

etc.  Pretty basic parent / child relationship derived from the generation format of the source table.                                    
0
 
sdstuberCommented:
your source data is strings with whitespace indenting?
or  actual columns ?

or do you have a data an level column as if generated from a hierarchical query?

in other words, what is your excel file trying to show me?

I get the "visual" parent/child relationships, what is the actual data?
0
 
Cheryl McCormickConsultantAuthor Commented:
The table looks just like the EXCEL spreaadsheet.  Each level is represented in a column.  There are null values... again, just like the excel spreadsheet but in unique columns per level.
0
 
sdstuberCommented:
how are you controlling the ordering of rows?

for instance,  how do we know 414300 is a child of REVESP and not of REVDRP?

what put it on row 11 vs row 14?
0
 
Cheryl McCormickConsultantAuthor Commented:
Question not completely answered.
0
 
sdstuberCommented:
you shouldn't give penalty grades while there are still pending questions to you.

the question could not be answered completely until you gave feedback
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now