Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Traversing hierarchy

Re: Traversing hierarchy

From: daustin <daustin_at_HRFOCUS.ATTMAIL.COM>
Date: Sun, 19 Mar 1995 15:55:15 -0500
Message-Id: <9503192156.AA26434@alice.jcc.com>

Re: >>     I have a table with 2 columns (descendant, ancestor) in which >>
  I have stored thesaurus data (narrower term, broader term). >>     Now, I
need to retrieve the hierarchy trees using ORACLE's >>    "start
with...connect by...." clauses of the SELECT stmt. >>     I have no problems
moving down the tree for a specific >>     term (i.e., collecting all BROADER
TERM relationships), but I am >>     unable to move up the tree (to collect
NARROWER TERM relationships) >>     for that same term.  Do I have to use
PL/SQL to accomplish this, >>     or can I do it with a simple SQL stmt? >>
  I would appreciate any information - the ORACLE manuals are very >> vague.

...SNIP SNIP... Karen:

A tree is as how you define it. In the case you have in mind you could change the query to read

  SELECT ancestor, descendant
  FROM thesaurus
  CONNECT BY PRIOR descendant = ancestor   START WITH ancestor = <start value>

Hope this helps!

Received on Sun Mar 19 1995 - 16:56:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US