Достичь иерархии, Отношения между родителями и детьми эффективным и простым способом

У меня есть стол как

create table site
(
site_Id int(5),
parent_Id int(5),
site_desc varchar2(100)
);

Значение полей:

site_Id : Id of the sites parent_Id : Parent id of the site site_desc : though not relevant to the question but it has the description of the site

Требование заключается в том, что если у меня есть site_id в качестве входных данных, и мне нужны все идентификаторы, помеченные под сайтом. Например:

                    A
                   / \
                  B   C
                / | \ /\
               D  E F G H
              /\
             I  J

Все узлы являются site_Id.

Таблица содержит такие данные:

Site_id  | Parent_ID  |  site_desc
_________|____________|___________
 A       |   -1       |   
 B       |    A       |
 C       |    A       |
 D       |    B       |
 E       |    B       |
 F       |    B       |
 I       |    D       |
 J       |    D       |

......

A является родителем B и C и так далее.

Если B является входным данным, то запрос должен выбрать D, E, I, F, J

В настоящее время это достигается с помощью нескольких запросов в цикле, но я думал об этом в минимальном количестве запросов.

Что я сейчас делаю:

голосование против

Алгоритм выглядит так:

Initially create a data set object which you will populate, by fetching data from the data base. 
Create a method which takes the parent id as parameter and returns its child nodes if present, and returns -1, if it doesnt have a child. 
Step1: Fetch all the rows, which doesn't have a parent(root) node. 
Step2: Iterate through this result. For example if prod1 and prod2 are the initial returned nodes, in the resultset. 
Iterating this RS we get prod1, and we insert a row in our DataSET obj. 
Then we send the id of prod1 to getCHILD method, to get its child, and then again we iterate the returned resultset, and again call the getCHILD method, till we dont get the lowest node.

Мне нужна лучшая оптимизированная техника в рамках моего ограничения модели данных. Не стесняйтесь ответить, если у вас есть какие-либо предложения.
Пожалуйста, предложите что-нибудь. Заранее спасибо.

Ответы на вопрос(10)

Ваш ответ на вопрос