Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Generating Resultset in Tree Form


Message #1 by "U K H" <registerukh@h...> on Wed, 08 May 2002 14:38:00 -0500
Can someone help me in generating a recordset from Oracle 8.x.x in Tree 
form... Basicall I need a sql or stored procedure...

My Table description is as follows:-

PKKey  Org_code  Level  Name     Parent_org_code
1       10         1    Parent     NULL
2       11         2    Child-1    10
3       12         2    Child-1    10
4       13         3    Child-2    11
5       14         3    Child-2    11
6       15         4    Child-3    14
...
...

EG:-
   Parent
      Child-1
         Child-2
            Child-3
            Child-3
         Child-2
            Child-3
      Child-1
         Child-2
            Child-3
            ...
            ...
            ...

Thanks

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx

Message #2 by "U K H" <registerukh@h...> on Wed, 08 May 2002 16:09:28 -0500
Never mind. I just found the solution upon researching on the net.
The sql is

select distinct * from <table> connect by prior org_code = parent_org_code



>From: "U K H" <registerukh@h...>
>Reply-To: "ASP Databases" <asp_databases@p...>
>To: "ASP Databases" <asp_databases@p...>
>Subject: [asp_databases] Generating Resultset in Tree Form
>Date: Wed, 08 May 2002 14:38:00 -0500
>
>
>Can someone help me in generating a recordset from Oracle 8.x.x in Tree
>form... Basicall I need a sql or stored procedure...
>
>My Table description is as follows:-
>
>PKKey  Org_code  Level  Name     Parent_org_code
>1       10         1    Parent     NULL
>2       11         2    Child-1    10
>3       12         2    Child-1    10
>4       13         3    Child-2    11
>5       14         3    Child-2    11
>6       15         4    Child-3    14
>...
>...
>
>EG:-
>   Parent
>      Child-1
>         Child-2
>            Child-3
>            Child-3
>         Child-2
>            Child-3
>      Child-1
>         Child-2
>            Child-3
>            ...
>            ...
>            ...
>
>Thanks
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
>




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


  Return to Index