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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Recursive SQL

Re: Recursive SQL

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Thu, 10 Jun 1999 15:00:57 GMT
Message-ID: <375fcc2d.3359290@inet16.us.oracle.com>


On Thu, 10 Jun 1999 12:56:09 GMT, radioaktiv_at_my-deja.com wrote:

>I have a (for me) difficult problem. I have some tables:
>
>CREATE TABLE Person(
> Person_ID number(10) PRIMARY KEY,
> Name varchar2 (50));
>
>CREATE TABLE Project (
> Project_ID number(10) PRIMARY KEY,
> Related_to_Project number (10),
> Project_Name varchar2 (50),
>FOREIGN KEY (Related_to_Project) REFERENCES Project (Project_ID));
>
>CREATE TABLE Project_Pers (
> Project_ID number (10) NOT NULL,
> Person_ID number (10) NOT NULL,
>FOREIGN KEY (Project_ID) REFERENCES Project (Project_ID),
>FOREIGN KEY (Person_ID) REFERENCES Person(Person_ID));
>
>Now I want to see all projects in which a person cooperates and the
>projects to which it is related to and the projects to which them are
>related to and so forth...
>That means I want to go down the tree from one or more leafs to the
>root, but I don't know the starting points, I only have a given
>Person_ID.
>Is this possible in Oracle's SQL? I know that there is a possibility in
>DB2 but Oracle?
>I would be very thankful for answers.

Looks like a homework assignment to me, so i'll give you a hint...

Look at the START WITH and CONNECT BY clauses for an Oracle select statement.

hope this helps.

chris.

>
>Thanx in advance
>
>Knut (Germany)
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jun 10 1999 - 10:00:57 CDT

Original text of this message

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