Recursive Query [message #336881] |
Tue, 29 July 2008 05:06  |
dev_sri
Messages: 4 Registered: July 2008 Location: Hyderabad
|
Junior Member |
|
|
Hi all,
Below is the table design:
select * from child;
REEID PID CID S
----- ---------- ---------- -
1001 101 102 Y
1002 101 103 Y
1003 102 104 N
1004 102 105 N
1005 103 106 N
1006 103 107 Y
6 rows selected.
select * from master;
CID QID RID AID
----- ---------- ---------- ----------
101 20
102 20
103 30
In Master,CID is PK column and in Child CID is the FK Column..
1)Now 101 is PK column in master and FK in child... this record has two child records 102 and 103.
2) 102 record again has child records..104 and 105..
QUESTION: I would like to have query till the leaf node(Last child records) for particular record in parent table(master).
please Help.
Regards,
` sri
|
|
|
Re: Recursive Query [message #336890 is a reply to message #336881] |
Tue, 29 July 2008 05:20   |
 |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
1/ please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Who knows which columns of "master" are filled in your post?
Use the "Preview Message" button to verify.
2/ Always post your Oracle version (4 decimals).
3/ Post a test case: create table and insert statements along with the result you want with these data.
4/ Use CONNECT BY and hierarchical query
Regards
Michel
[Updated on: Tue, 29 July 2008 05:21] Report message to a moderator
|
|
|
|
|