Oracle Query hierarchical relations with "connect by"

From WickyWiki
Revision as of 07:26, 5 July 2013 by Admin (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Table HIERACHY has a master and a child key and an ROOT indication (indexed) the following query will show all possible paths using master-child relations, starting in records marked with ROOT=1

select SYS_CONNECT_BY_PATH(MASTER, '/')
  from HIERACHY
	connect by prior CHILD = MASTER
	start with ROOT=1
  ;