Home » SQL & PL/SQL » SQL & PL/SQL » very urgent...how to do looping inside a table
very urgent...how to do looping inside a table [message #18913] Thu, 21 February 2002 00:26 Go to next message
ksr
Messages: 112
Registered: January 2002
Senior Member
Hi,
I have a table called tab1(parent number,child number).

sample data
------------
parent child
1 2
1 3
2 4
2 5
4 6
4 7
3 8
3 9

Now i want to find out all the childs and their childs and their childs.

Suppose i want all the childs of parent 1 and then insert the data into a temporary table.

I will be passing a array of parent ids and it should search for all childs and their childs and fill the temporary table.

How can i do this either through sql or plsql.

i should get the data like

child
------
2
3
4
5
6
7
Re: very urgent...how to do looping inside a table [message #18919 is a reply to message #18913] Thu, 21 February 2002 05:29 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
use connect by.. start with clauses in sql.

see hierarchical queries in documentation
Previous Topic: Re: How to insert pictures in a table
Next Topic: example of returning clause with insert needed
Goto Forum:
  


Current Time: Fri Apr 19 13:44:13 CDT 2024