Skip to content

Instantly share code, notes, and snippets.

@ip75
Created April 16, 2019 14:32
Show Gist options
  • Save ip75/2a65ce8c388d4180329f718ff9257140 to your computer and use it in GitHub Desktop.
Save ip75/2a65ce8c388d4180329f718ff9257140 to your computer and use it in GitHub Desktop.
get view of tree using select. oracle 11g
------------------- HIERARCHYID => MERCID ---------------------------
select lpad(' ', 6 * level) || h.displayname as Tree,
hd.value mercid,
h.hierarchyid,
h.authid,
h.searchkey,
ad.dataid
from AUTHHIERARCHY h
left join hierarchydata hd
on hd.hierarchyid = h.hierarchyid
and hd.key = 'mercid'
left join authdata ad on ad.authid = h.authid
start with h.parentid = 0
connect by prior h.hierarchyid = h.parentid
-------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment