Home » SQL & PL/SQL » SQL & PL/SQL » to get the results in the form of a tree (Oracle 11g xe, Windows 7)
to get the results in the form of a tree [message #571395] Sun, 25 November 2012 09:35 Go to next message
mr.rajeshyadav
Messages: 48
Registered: November 2007
Member
Hi,

My table structure is like this

CREATE TABLE Tab1(LVL1_NM VARCHAR2(20), LVL2_NM VARCHAR2(20), LVL3_NM VARCHAR2(20), LVL4_NM VARCHAR2(20)) and the values will be for one value of LVL1_NM there will be different LVL2_NM values like wise for each and every value of LVL2_NM column there will different values in LVL3_NM column like wise for LVL4_NM now can you please tell is there any way to get the results as per their relation ships.

please have a look at the image attached to show how i am expecting results.

Thanks,
Rajesh.

./fa/10529/0/
  • Attachment: IMG2.png
    (Size: 11.33KB, Downloaded 111 times)

[Updated on: Sun, 25 November 2012 09:36]

Report message to a moderator

Re: to get the results in the form of a tree [message #571396 is a reply to message #571395] Sun, 25 November 2012 09:40 Go to previous messageGo to next message
BlackSwan
Messages: 22539
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: to get the results in the form of a tree [message #571401 is a reply to message #571395] Sun, 25 November 2012 10:32 Go to previous messageGo to next message
Michel Cadot
Messages: 58625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So write or buy a program that can display the output as you want.
What do you expect from us, in a SQL forum?

Regards
Michel
Re: to get the results in the form of a tree [message #571404 is a reply to message #571401] Sun, 25 November 2012 11:02 Go to previous messageGo to next message
mr.rajeshyadav
Messages: 48
Registered: November 2007
Member
I am not expecting total solution, if you can just throw an idea on which lines i have to think that will be really great help.

Thanks,
Rajesh.
Re: to get the results in the form of a tree [message #571405 is a reply to message #571404] Sun, 25 November 2012 11:17 Go to previous messageGo to next message
Michel Cadot
Messages: 58625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
With any SQL or PL/SQL question, please, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel
Re: to get the results in the form of a tree [message #571412 is a reply to message #571405] Sun, 25 November 2012 12:48 Go to previous messageGo to next message
dariyoosh
Messages: 531
Registered: March 2009
Location: Iran / France
Senior Member
"mr.rajeshyadav"
... can you please tell is there any way to get the results as per their relation ships ...

In addition, strictly speaking, from a graph theory and data structure point of view, the picture you provided is not a tree, as the 7th node (counting from up downwards) in the third level has two parents whereas a tree is an acyclic graph. Consequently, are you sure what you're looking for, can be presented as a tree?


Regards,
Dariyoosh

[Updated on: Sun, 25 November 2012 12:49]

Report message to a moderator

Re: to get the results in the form of a tree [message #571466 is a reply to message #571412] Mon, 26 November 2012 03:55 Go to previous messageGo to next message
mr.rajeshyadav
Messages: 48
Registered: November 2007
Member
./fa/10534/0/

Please find modified image.
  • Attachment: graph.png
    (Size: 13.65KB, Downloaded 89 times)
Re: to get the results in the form of a tree [message #571469 is a reply to message #571466] Mon, 26 November 2012 03:59 Go to previous message
Michel Cadot
Messages: 58625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Sun, 25 November 2012 18:17
With any SQL or PL/SQL question, please, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel

Previous Topic: The problem of use Order By
Next Topic: UNION ALL output in multiple colums
Goto Forum:
  


Current Time: Wed Jul 30 22:59:06 CDT 2014

Total time taken to generate the page: 0.09864 seconds