在Oracle-Apex中创建树形图该怎么办?我已经尝试了一切,但无法生成树形图。
我正在尝试使用siguienet查询生成该图:
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1 else -1 end as status,
level,
ename as title,
'icon-tree-folder' as icon,
empno as value,
ename as tooltip,
null as link
from emp
start with mgr is null
connect by prior empno = mgr
order siblings by ename
答案 0 :(得分:1)
“无法创建树形图”是什么意思?为什么不?
最简单的方法是:
查询如下:
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"ENAME" as title,
null as icon,
"EMPNO" as value,
null as tooltip,
null as link
from "#OWNER#"."EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME"
与您的基本相同(我没有做任何更改,因此列名用双引号引起来,FROM
子句包含#OWNER#
)。
如果存储在表中的数据构成了层次结构,它将起作用;没有理由不这样做。