行转列

SELECT ltrim(MAX(sys_connect_by_path(name, '/')), '/')
FROM (SELECT t.name,ROWNUM rn
FROM (SELECT t.name
FROM (SELECT d.id, d.parent_id, d.name,ROWNUM rn
FROM oauth_role d
START WITH d.id =4
CONNECT BY PRIOR d.parent_id = d.id) t
ORDER BY t.rn DESC) t)
START WITH rn = 1
CONNECT BY rn - 1 = PRIOR rn;

posted @ 2019-12-09 11:25  albert_think  阅读(190)  评论(0编辑  收藏  举报