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: Top parent in START WITH...CONNECT BY

Re: Top parent in START WITH...CONNECT BY

From: Thomas B. Cox <tbcox23_at_yahoo.com>
Date: Tue, 29 Jan 2002 14:07:55 -0800
Message-ID: <F001.003FF9E0.20020129134556@fatcity.com>

You should create a pure function that returns the top parent. This would be a simple PL/SQL loop that walks to the top of the tree for the given Emp name. Performance might be less than brilliant but that's the price you pay.

Once the function is in place -- call it TopParent() -- then you just

  select ename , mgr , TopParent(ename), ...   from emp
  where ...

You'll find that TopParent ( 'Jesse' ) = 'Sciarra'.

Simple.

 -Tom


Thomas B. Cox "Saepe in errore sed numquam in dubito" tbcox23@yahoo.com http://www.geocities.com/tbcox23/

"The whole aim of practical politics is to keep the populace alarmed (and hence clamorous to be led to safety) by menacing it with an endless series of hobgoblins, all of them imaginary." --H.L. Mencken



Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Thomas B. Cox
  INET: tbcox23_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jan 29 2002 - 16:07:55 CST

Original text of this message

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