Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Question on Hierarchy
> Hi,
>
> I have a table which has data on father and sons
>
> SQL> desc father_sons
> Name Null? Type
> ----------------------------------------- -------- ------------
> FATHER VARCHAR2(1)
> SON VARCHAR2(1)
>
> The data in the table looks something like this
>
> SQL> select * from father_sons;
>
> F S
> - -
> a b
> b c
> c d
>
> where b is the son of a
> c is the son of b
> d is the son of c
>
> Lets say I were given "a" and "d" and asked to find out whether they
> are related or not. In this case they are.
>
> How do i write a query which just gives me true or false on whether
> they are related or not.
Ron
Maybe, the following link helps on that
http://www.adp-gmbh.ch/ora/sql/connect_by.html#is_parent
Rene
-- Rene Nyffenegger www.adp-gmbh.chReceived on Wed Aug 20 2003 - 02:42:55 CDT