Tree SQL from hierarchical path data
ligonglJan 12 2012 — edited Jan 12 2012Hello 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