In project development, the tree structure is often used. Usually we use some free JS files to use some free JS files to achieve a good display effect, such as, but sometimes we need to provide a tree. Structure (such as the sector jump of the forum), this time we can use the CONNECT BY clause provided by Oracle9i or later. SELECT KINDID, KINDNAME, FATHERID from Kn_Kind Connect by Prior Kindid = FatherId Start with KindId = '0'; again to get a need to get the effect: SELECT LPAD ('| -', (Level-1) * 4, ' ') || LPAD (' ", 2) || Kindname || RPAD ('"', 2) Kindname from kn_kind connect by prior kindid = Fatherid Start with KindId = '0';