Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tree SQL from hierarchical path data

ligonglJan 12 2012 — edited Jan 12 2012
Hello There,

I have a single column table created from an Active Directory webservice (list of functional groups). Sample table records are as below.

DGCONN_GRP1
DGCONN_GRP2
DGCONN_GRP2_A
DGCONN_GRP2_B
DGCONN_GRP2_A_2
PDDCP_TT1
.... so on..

I need to write an SQL using this data for a tree structure.
For example something like:

select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"SITE_PATH" as title,
"SITE_PATH" as value,
from <TABLE>
start with "SITE_PATH" is null
connect by prior "SITE_PATH" = <PARENT_SITE_PATH>

Any help would be great. Thanks for looking
Cheers
Ligon
This post has been answered by Frank Kulash on Jan 12 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 9 2012
Added on Jan 12 2012
5 comments
372 views