Hierarchický dotaz
Michal Zaschke
zaschke na suas.cz
Pondělí Červen 11 14:07:43 CEST 2001
Vytazeno z manualu - doufam, ze pomuze...
The LEVEL Pseudocolumn
SELECT statements that perform hierarchical queries can use the LEVEL
pseudocolumn. LEVEL returns the value 1 for a root node, 2 for a child
node of a root
node, 3 for a grandchild, etc. For more information on LEVEL, see the
section "Pseudocolumns".
The number of levels returned by a hierarchical query may be limited by
available user memory.
The following statement is similar to the first one, except that it uses
the LEVEL pseudocolumn to select only the first two levels of the
management hierarchy:
SELECT LPAD(' ',2*(LEVEL-1)) || ename org_chart,
empno, mgr, job
FROM emp
START WITH job = 'PRESIDENT'
CONNECT BY PRIOR empno = mgr AND LEVEL <= 2;
ORG_CHART EMPNO MGR JOB
------------ ---------- ---------- ---------
KING 7839 PRESIDENT
JONES 7566 7839 MANAGER
BLAKE 7698 7839 MANAGER
CLARK 7782 7839 MANAGER
Vladimir Naprstek píše:
>
> Zdravím,
>
> lze hierarchický dotaz (Oracle) omezit na úrovně, do kterých až se má
> hrabat?
> Zatím jsem v dokumentaci nic nenašel...
> --
> Vladimír Náprstek e-mail: vladimir.naprstek na prodeco.cz
--
Ing. Michal Zaschke
DB Administrator
Sokolovska uhelna, a.s.
phone: +420-168-465417
e-mail: zaschke na suas.cz
Další informace o konferenci Databases