Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Query Treewalk Teaser
"Mike Cretan" <mcretan_at_ozemail.com.au> wrote in
news:JS4z8.36$HM.31016_at_vicpull1.telstra.net:
> Hi Folks,
>
> DB 8.1.7 on NT
>
> I'm no newbie, but I'm having some issues figuring out which way to go
> about this one, and I'd appreciate some help...
>
> I have a table structure as follows:
>
> .---------.
> | Identity |
> '---------'
> | |
> n n
> .--------------.
> | Relationship |
> '--------------'
>
> i.e an identity can be related to many other identities, which can in
> turn be related to many other identities.
>
> The relationship is not strictly hierarchical like the old emp manager
> example.
>
> What I would like to get is the entire set of identities that have any
> relationships given a starting identity?
>
> With Oracle, how can I tree walk the entire set of relationships and
> list the identities. I don't care about the level, just the related
> identities.
>
> Many thanks in advance,
>
> Mike Cretan
>
>
>
>
>
>
This sounds like you might be able to make use of a recursive descent algorithm; similar to one which traverses a B-tree. Received on Mon Apr 29 2002 - 20:22:19 CDT