快捷搜索:

oracle树结构查询语句


oracle树结构查询语句   SELECT RPAD(' ', 4 * (LEVEL-1), '--') || name as name,         东方财富CONNECT_BY_ROOT name "ROOT",    www.2cto.com          CONNECT_BY_ISLEAF "ISLEAF",         LEVEL,         t.*,         SYS_CONNECT_BY_PATH(t.name, '/') "PATH"      from sys_department t  START WITH T.DEPARTMENTID = 1  CONNECT BY NOCYCLE PRIOR T.Departmentid = T.PARENTDEPARTMENTID  order siblings by t.departmentid;    SELECT RPAD(' ', 2 * (LEVEL - 1), '-') || Tn_Id,         CONNECT_BY_ROOT Tn_Id "ROOT",         CONNECT_BY_ISLEAF "ISLEAF",         LEVEL,         t.*,         SYS_CONNECT_BY_PATH(t.Tn_Id, '/') "PATH"      from (    (SELECT c.tn_id, c.tn_name, c.parent_id, c.orders             FROM tree_node_c c            where c.proj_phase = 'PD'              and (c.view_mode = 2 or c.view_mode = 0) )              union          select d.tn_id, d.tn_name, d.parent_id, d.orders             from tree_node_d d            where d.proj_id = '15-B154C'              AND (d.view_mode = 2 or d.view_mode = 0)              and d.proj_phase = 'PD'              ) t  START WITH T.Parent_Id = 'DP1_000'  CONNECT BY NOCYCLE PRIOR T.Tn_Id = T.PARENT_ID  order siblings by orders  

http://www.bkjia.com/oracle/483225.htmlwww.bkjia.comtruehttp://www.bkjia.com/oracle/483225.htmlTechArticleoracle树结构查询语句 SELECT RPAD( , 4 * (LEVEL-1), --) || name as name, CONNECT_BY_ROOT name ROOT, www.2cto.com CONNECT_BY_ISLEAF ISLEAF, LEVEL, t.*, SYS_CONNECT_BY_PATH(t.n...

本文源自: AG88环亚

您可能还会对下面的文章感兴趣: