oracle 递归查询整个路径并行转列组合成字符串

递归查询路径:

select * from t_db_organize connect by prior fartherid=id start with id='139312' order by id asc

这里写图片描述

行转列:

select replace(wm_concat(to_char(name)),',',' > ') name from(select * from t_db_organize connect by prior fartherid=id start with id='139312' order by id asc);

wm_concat:行转列,默认逗号分隔,中文会乱码,使用to_char可以避免

这里写图片描述

相关文章
相关标签/搜索