Hierarchical Data

This section presents various topics related to hierarchical data (also known as "tree structured" data). An example of hierarchical data is shown below.

KEY        PARENT_KEY
---------- ----------
nls        (null)
demo       nls
mesg       nls
server     (null)
bin        server
config     server
log        config
ctx        server
admin      ctx
data       ctx
delx       data
enlx       data
eslx       data
mig        ctx
 

It is often useful to order and display such rows using the hierarchical relationship. Doing so yields a result set that looks like this (KEY values are indented to highlight the hierarchicy).

KEY_INDENTED    KEY_PATH
--------------- -------------------------
nls             /nls
 demo           /nls/demo
 mesg           /nls/mesg
server          /server
 bin            /server/bin
 config         /server/config
  log           /server/config/log
 ctx            /server/ctx
  admin         /server/ctx/admin
  data          /server/ctx/data
   delx         /server/ctx/data/delx
   enlx         /server/ctx/data/enlx
   eslx         /server/ctx/data/eslx
  mig           /server/ctx/mig
 

In this tutorial we explore various Oracle mechanisms for working with hierarchical data.




Linking to SQL Snippets ™

To link to this page in Oracle Technology Network Forums or OraFAQ Forums cut and paste this code.

  • [url=http://www.sqlsnippets.com/en/topic-10364.html]SQL Snippets: SQL Features Tutorials - Hierarchical Data[/url]

To link to this page in HTML documents or Blogger comments cut and paste this code.

  • <a href="http://www.sqlsnippets.com/en/topic-10364.html">SQL Snippets: SQL Features Tutorials - Hierarchical Data</a>

To link to this page in other web sites use the following values.

  • Link Text : SQL Snippets: SQL Features Tutorials - Hierarchical Data
  • URL (href): http://www.sqlsnippets.com/en/topic-10364.html

Revision Notes

Date Category Note
2007-08-05 Revision The test data in this section was changed to make the examples a little clearer.