Home » SQL & PL/SQL » SQL & PL/SQL » hierarchial query (oracle 10g)
hierarchial query [message #642403] Thu, 10 September 2015 00:16 Go to next message
kadhirvel.k
Messages: 10
Registered: August 2015
Location: chennai
Junior Member
LEVEL PARENT Description

WEST IND Western Region 1
GUJR WEST Gujarat
AHMD GUJR Ahmedabad
AHM AHMD Ahmedabad Branch

Hi,

I Have a table mentioned above. I know the value 'AHM'. Using this i need to connect the Level with the parent. The Output should be like below.

AHM
AHMD
GUJR
WEST
IND

Please provide me a query for this.
Thanks in advance.
Re: hierarchial query [message #642405 is a reply to message #642403] Thu, 10 September 2015 00:46 Go to previous messageGo to next message
bugfox
Messages: 18
Registered: October 2010
Junior Member
select "LEVEL" 
from <YOUR_TABLE>
start with "LEVEL" = 'AHM'
connect by "LEVEL" = prior "PARENT"
Re: hierarchial query [message #642406 is a reply to message #642403] Thu, 10 September 2015 00:49 Go to previous message
Michel Cadot
Messages: 68776
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) 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.

Show us what you already tried and where you are stuck.

In the end feedback to and thank people who helped you in your previous topic.

Previous Topic: How to display employee table information based on salary in different ranges
Next Topic: Compare 2 encrypted values
Goto Forum:
  


Current Time: Thu Aug 06 22:32:40 CDT 2026