HANA Hierarchy 获取节点路径
HANA Hierarchy没有提供sys_connect_by_path的功能,只有通过程获取:
DO
BEGIN
allhr =
select HIERARCHY_RANK id, HIERARCHY_PARENT_RANK pid, parent_id item, node_id node from (SELECT HIERARCHY_RANK,HIERARCHY_TREE_SIZE,HIERARCHY_PARENT_RANK,HIERARCHY_ROOT_RANK,HIERARCHY_LEVEL,HIERARCHY_IS_CYCLE,HIERARCHY_IS_ORPHAN,PARENT_ID,NODE_ID
FROM hierarchy (
SOURCE (SELECT name parent_id,idnrk node_id FROM pcdw.ecc_bom a WHERE WERKS ='L070')
START WHERE name IN ('7D04CTO1WW','7X18CTO1WW')
));
curpath = select id,pid,item,node,item root,item||','||node path from :allhr a where pid=0;
while (select count(*) from :curpath where id is not null) >0 do
curpath = select b.id,b.pid,b.item,b.node,a.root,ifnull(a.path||','||b.node,a.path) as path
from :curpath a left join :allhr b on a.id=b.pid and a.node = b.item;
end while;
select root,path from :curpath;
END;
post SAP-Garson
原文链接:https://blog.csdn.net/usoa/article/details/121145634文章来自于网络,如果侵犯了您的权益,请联系站长删除!