Requêter un arbre

12-10-2016

Pour effectuer une requête dans un arbre, vous pouvez utiliser « start with » et « connect by ».

Voici un exemple pour afficher les options de menu avec un décalage de 2 espaces à chaque changement de niveau

Code: Tout sélectionner
select lpad(' ',2*(level-1)) || to_char(A.ID_MENU) ID, lpad(' ',2*(level-1)) || to_char(B.TRANS_MENUFRA) Libellé
from M4RMN_TREE A, M4RMN_OPTIONS B
WHERE A.ID_MENU=B.ID_MENU
start with A.ID_PARENT_MENU= 'Mind'
connect by prior A.ID_MENU = A.ID_PARENT_MENU

«