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

Home -> Community -> Usenet -> c.d.o.server -> Re: hierarchical query - returning a treewalked subset

Re: hierarchical query - returning a treewalked subset

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 09 Nov 2007 11:52:36 -0800
Message-ID: <1194637952.164152@bubbleator.drizzle.com>


SpaceMarine wrote:
> On Nov 9, 4:00 am, havardk <hrkristiansen..._at_hotmail.com> wrote:

>> Ah... Now I understand your problem. Avoiding duplicates complicates
>> matters, because then you will have to traverse the tree the other way
>> to see if any other candidate is listed higher, starting from all rows
>> that satisfy your "start with" criteria.
>>
>> The select below is even slower, but still works for this problem. I
>> suspect there is an easier way to solve this :-)

>
> yeah. i think it may be better just to keep the resultset w/ dupes,
> and then run it thru a scrubber in application code (which is what im
> doing now). my C# method loops thru the resultset (which is usually
> pretty small), and if a row is LEVEL 1, it loops thru the resultset
> again looking for a > LEVEL 1 row. if found, it knows the original-row
> is a child and shouldnt be a root, so it flags it for removal. after
> the initial pass all removals are performed (in a reverse loop to
> preserve row-number integrity), each one cascading down to remove the
> removal-row's children. works.
>
>
> thanks for the suggestions!
>
> sm

Take any query that produces a result set in Oracle. Wrap it with parentheses so it becomes an in-line view. SELECT DISTINCT from it.

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Nov 09 2007 - 13:52:36 CST

Original text of this message

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