更新树层结构

  MERGE INTO tt_secu_orgs p
  USING (select id, level as c_level
      , substr(sys_connect_by_path(id,'-')||'-',2) nest_path
          from tt_secu_orgs
               start with id = 1
              connect by nocycle prior id = parent_id) np
  ON (p.id = np.id)
  WHEN MATCHED THEN
  UPDATE SET p.current_level = np.c_level, p.org_str = np.nest_path;

原文地址:https://www.cnblogs.com/sihai6b204/p/3200258.html