Home » SQL & PL/SQL » SQL & PL/SQL » Recursive Hierarchy Help
Recursive Hierarchy Help [message #637702] Thu, 21 May 2015 18:55 Go to next message
kiekar
Messages: 1
Registered: May 2015
Junior Member
Hello,
First I would like to say that I only have basic SQL skills. I have one table PN_NEXT_LOWER_ASSEMBLY with two fields NHA_PN and NLA_PN that I need to work with that holds hierarchy data. The DB is Oracle but I'm not sure what version. I know from using visual representation that the most upper hierarchy PN is '49-20005-1' and that there is 4 levels down from there

I ran this query but I am not getting the results I need. As you will see level 2 is outputting
the same NLA_PN but should be outputting the P/Ns displayed in the next image.

I have copy of the output below and the actual hierarchy tree.

Any suggestions why I'm not getting the proper results would be much appreciated.

Thanks.

SELECT NHA_PN, NLA_PN, LEVEL 
FROM PN_NEXT_LOWER_ASSEMBLY 
WHERE NHA_PN = '49-20005-1' 
CONNECT BY PRIOR NHA_PN = NLA_PN 
ORDER BY LEVEL ASC


/forum/fa/12686/0/

/forum/fa/12685/0/


[EDITED by LF: fixed invalid image tag]

[Updated on: Fri, 22 May 2015 00:52] by Moderator

Report message to a moderator

Re: Recursive Hierarchy Help [message #637704 is a reply to message #637702] Thu, 21 May 2015 20:37 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: Recursive Hierarchy Help [message #637992 is a reply to message #637704] Sun, 31 May 2015 13:38 Go to previous messageGo to next message
Amine
Messages: 371
Registered: March 2010
Senior Member

Welcome to the forum,
Post a test case :
1. Objects creation (tables, inserts,...)
2. Wanted output
Re: Recursive Hierarchy Help [message #637993 is a reply to message #637992] Sun, 31 May 2015 13:45 Go to previous message
Michel Cadot
Messages: 68617
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Hopefully you are there to repeat the requirements 10 days later when it is obvious that OP doesn't want to come back.

Previous Topic: Displaying calculated field with selected rows and Adding row according to date condition
Next Topic: dbms_scheduler
Goto Forum:
  


Current Time: Mon Mar 18 23:29:36 CDT 2024