数据库
首页 > 数据库> > oracle 通过编码自动修改父子级和级次,叶子节点

oracle 通过编码自动修改父子级和级次,叶子节点

作者:互联网

UPDATE p#BIM_INC_EXP_SORT a
SET (a.parentid, a.levelno, a.isleaf) =
(SELECT b.parentid, b.levelno, b.isleaf
FROM (select unqguid,
(select max(unqguid)
from p#BIM_INC_EXP_SORT
where code = substr(t.code, 1, len(t.code) - 2)) parentid,
LEVEL levelno,
connect_by_isleaf isLeaf
from p#BIM_INC_EXP_SORT t
start with len(code) = 3
connect by prior code = substr(code, 1, len(code) - 2)) b
WHERE a.unqguid = b.unqguid)
WHERE 1 = 1

标签:SORT,unqguid,code,级次,levelno,BIM,EXP,oracle,节点
来源: https://www.cnblogs.com/sx2zx/p/12855983.html