Urgent Help plzzzzzzzzz - Hierarchical Tree [message #87485] |
Fri, 07 January 2005 05:05 |
oralover
Messages: 97 Registered: January 2005
|
Member |
|
|
hi all!
may be you laugh on me but i want to know anyway.
i am using 6i and 10g and wants to know about Hierarchical Tree to populate records like :
1) from emp table which DO NOT HAVE mgr field
2) display data as:
-DEPTNO
-- emp1
-- emp2
-- emp3
-DEPTNO
-- emp1
-- emp2
-DEPTNO
-- emp1
-- emp2
i used - or -- only to make Levels its not required.
please write an SQL statement to populate Hierarchical Tree for above.
thanks in advance for help.
|
|
|
|
Re: Urgent Help plzzzzzzzzz - Hierarchical Tree [message #114672 is a reply to message #87485] |
Mon, 04 April 2005 16:56 |
oratim
Messages: 1 Registered: April 2005
|
Junior Member |
|
|
Try this:
> break on department;
> Select department, employee from emp_table;
This should give you the output you are looking for. If you want a truly hierarchical query where there is parent and child relationship within table look at connect by clause, connecting the parent to the child.
Good luck. Hope this helps.
|
|
|
Re: Urgent Help plzzzzzzzzz - Hierarchical Tree [message #114738 is a reply to message #114672] |
Tue, 05 April 2005 07:42 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
Nah, in forms? BREAK? I don't think so.
oralover, try this query in the 'DATA QUERY' property of your tree item:
SELECT -1 state
, DECODE (deptno, NULL, 2, 1) dlevel
, DECODE (deptno, NULL, 'Employee ' || ename, 'Department ' || dname) label
, NULL icon
, DECODE (deptno, NULL, deptno, deptno) DATA
FROM (SELECT DECODE (LAG (d.deptno) OVER (ORDER BY d.deptno), d.deptno, NULL, d.deptno) deptno
, d.dname
, e.ename
, e.empno
FROM emp e, dept d
WHERE d.deptno = e.deptno
ORDER BY d.deptno)
In the small test I ran, it gave the following output:
MHE
-
Attachment: formtree.jpg
(Size: 10.55KB, Downloaded 2810 times)
|
|
|
|
|
|
|
|
|