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: Connect by dumps

Re: Connect by dumps

From: Lucyna Witkowska <ypwitkow_at_nospamcyf-kr.edu.pl>
Date: Thu, 13 Nov 2003 13:22:18 +0000 (UTC)
Message-ID: <bp00ia$14f$1@srv.cyf-kr.edu.pl>


Ray <rbujarski_at_hotmail.com> wrote:
> I have a hierarchical relationship that I want to dump the entire
> family given a parent. I have a table that tracks parents and
> children relationships, I want to create a view that dumps the entire
> family given a parent.
> Scenario:
> p1 has child p2, p2 has child p3.
> Given p1, result set from view should be p2 and p3, given p2 result
> set from view should be p3 etc...

> Here is my pl/sql that creates the view:

> create view treepath
> as
> SELECT parent, child
> FROM td_view_dependants
> START WITH parent in (select parent from td_view_dependants)
> CONNECT BY child = prior parent

> However the results from this are p1 has p2 and p2, p2 has p3.

If you want start with p1 just write:
START WITH parent = 'p1'

If you want to go down the tree:
CONNECT BY PRIOR child = parent

greetings,
LW Received on Thu Nov 13 2003 - 07:22:18 CST

Original text of this message

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