Application Express

Welcome nobody( Logout )
Home
HomeLearn Application ExpressDemonstrationsHierarchy
Help

About

Click an employee name to show that employees reports, peers, and management. This demonstration highlights the SQL CONNECT BY syntax.

Demos

  • Calendar
  • Chart
  • Data Entry Form
  • Hierarchy
  • Interactive Report
  • Map
  • Master Detail
  • Pivot
  • Dashboard
  • Tree
  • XML
Select columns to search

  • Select Columns
  • Filter
  • Error rendering report: ORA-04031: unable to allocate 24 bytes of shared memory ("large pool","unknown object","kxs-heap-w","qesdcf_dfb_reset:qesdcfm")

    SQL

    with q as (  
          select level lvl,
                   empno
          from wwv_demo_emp e
          connect by prior empno  = mgr
          start with empno = nvl(:P14_ROOT,7839)
    ) 
    select SYS_CONNECT_BY_PATH(sub.ename,'/') path,
       level,
       LPAD(' ',((18*(level-1))+1),' ') ||
       '<a href="f?p=4600:14:'||:app_session||':::14:P14_START_WITH:'||empno||'">'||sub.ename||'</a>' ename,
       job,
       sal,
       comm,
       work_city,
       work_country,
       empno,
       mgr,
       (select ename from wwv_demo_emp x where x.empno = sub.mgr) manager,
       (select count(*) from wwv_demo_emp x where x.mgr = sub.empno) directs,
       nvl((select count(*) from wwv_demo_emp x connect by prior x.empno = x.mgr start with empno = sub.empno),1) -1 total_employees
    from (
        -- employees above start with employee
        select e.* 
        from wwv_demo_emp e
        connect by prior mgr=empno
        start with empno = nvl(:P14_START_WITH, 7839)
       union 
        -- employees who are are peers of the start with employee
        select e.* 
        from wwv_demo_emp e
        where level = (select lvl from q where empno =  nvl(:P14_START_WITH,7839)) 
        connect by prior empno  = mgr
        start with empno = nvl(:P14_ROOT,7839) 
       union 
        -- employees directly below start with employee
        select e.* 
        from wwv_demo_emp e
        where mgr  = nvl(:P14_START_WITH,7839)
      ) sub    
    connect by prior empno  = mgr
    start with empno = nvl(:P14_ROOT,7839) 
Application Express 4.0.2.00.07
Workspace: INTERNAL User: nobody
Language: en | Copyright © 1999, 2010, Oracle. All rights reserved.