Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> SQL query of a tree structure

SQL query of a tree structure

From: Marc Demlenne <marc.demlenne_at_gmail.com>
Date: Wed, 27 Apr 2005 21:39:51 +0200
Message-ID: <a25b91ba0504271239faeac78@mail.gmail.com>


Hi all,

I'm searching help to solve the following problem :

I have to query an ORACLE db to get a tree structure which is stored inside=
.

The DB already exists, and i'm not able to modify its structure. I could only add supplementary columns if necessary.

The trees (which represents a decisional tree) is stored in multiple tables. We have one for root, and one table by type of decision criterions or by leaf. On each record of each tree table, we have in addition to usefull parameters proper to each criterion, 4 "tree specific" ones which gives respectively the TYPE and NODEID of previous and next node in the tree.
The 'custom columns' can vary a lot for one criterion to another, but the 'tree specific' ones are always the same, except for root'

So, eg :

Root :

CUSTOM INFOS  -  NXT_TYPE  -  NXT_NODEID
azezerert     -  12        -  2
azefsdfsdf    -  15        -  1

For criterion 1 (criterion type =3D 12) :

CUSTOM INFOS  -  NODE_ID  -  NXT_TYPE  -  NXT_ID  -  PREV_TYPE  -  PREV_ID
blabla        -     1     -     ...
sdfsf df      -     2     -     18     -     2    -     1       -     1
sddffsf df    -     2     -     18     -     3    -     1       -     1
blabla        -     3     -     ...

For criterion 2 (criterion type =3D 15) : CUSTOM INFOS - NODE_ID - NXT_TYPE - NXT_ID - PREV_TYPE - PREV_ID sdfsf df - 1 - 25 - 17 - 1 - 2

...

So I'm trying to get in SQL a simple way to get this structure, in order to display it on a GUI without having to query the tree as many times as criterions it contains ...

If someone could help, it would be very appreciated ...

Thanks a lot,=20
--=20
Marc Demlenne
GPG : 768FA483 (http://pgp.mit.edu)

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 27 2005 - 15:46:31 CDT

Original text of this message

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