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 -> URGENT need soln to this problem.. for PROJECT interview...

URGENT need soln to this problem.. for PROJECT interview...

From: Aditi <drool.galz_at_gmail.com>
Date: 25 Apr 2007 05:12:02 -0700
Message-ID: <1177503122.554677.111210@s33g2000prh.googlegroups.com>


Hi everyone!
PLEASE suggest a solution for this problem i need to submitt it in 3 hrs... for my project interview..thanks

Following is the problem, You need to come up with a solution for it in PL/SQL, Write a working stored proc for the same.

Consider the following table:

     Person A Person B Relationship

        1               3               a
        3               2               b
        4               6               c
        4               5               d
        6               2               e
        4               7               f
	8               9               g
	9               4               h
	2               6               i
	7               1               j
	2               3               p
	1               7               k
	3               6               l
	7               5               m
	5               4               n
	8               3               o
	9               3               p
	4               6               q

What is needed to be done is:

Recursively loop through this table given 2 arguments Person A and Person B. Find all unique paths which lead from A to B and keep concatenating the relationship in the output .

Take this example for reference:



Relation 1:

Anil is brother of Seema,
Seema is friend of Meena and
Meena is child of Teena

Relation 2:

Anil is friend of Guru
Guru is brother of Ram
Ram is father of Sham
Sham is child of Reema and
Reema is friend of Teena

Then find out the all the relationships b/w Anil and Teena.

Anil, Teena are the input parameters.

First output: Anil - brother of - Seema- friend of - Meena - child of
- Teena

Second output: Anil - friend of - Guru - brother of - Ram - father of
- Sham -child of - Reema - friend of - Teena


Likewise, you have to find all the unique relations that can exist between A and B without getting into an infinite loop.

Please follow standards and naming conventions followed in your last project.

Please send the solution as an attachment. Received on Wed Apr 25 2007 - 07:12:02 CDT

Original text of this message

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