HELP: Problem with Hierarchical Data and ReportWriter 1.1

From: Jari Heinonen <jari_at_relatech.fi>
Date: Fri, 13 Jan 1995 13:08:09
Message-ID: <jari.6.000D2317_at_relatech.fi>


Hello,

All the Oracle SQL and ReportWriter experts out there help me, please!

I have an interesting problem with ReportWriter 1.1 and SQL.

I'm trying to print out a hierarchical data so that it would be in a alphabetical order within each level.

For example the EMP-table has a hierarchical structure where MGR-column denotes manager of an employee. The following query lists all the employees in a hierarchical order:

  select lpad(' ',2*level) || empno, ename   from scott.emp
  connect by prior empno = mgr
  start with mgr is null

 7839 KING
    7566 JONES

      7788 SCOTT
        7876 ADAMS
      7902 FORD
        7369 SMITH
    7698 BLAKE
      7499 ALLEN
      7521 WARD
      7654 MARTIN
      7844 TURNER
      7900 JAMES
    7782 CLARK
      7934 MILLER

This is fine but now I would like to have all the employees in alphabetical order within each level. The output would be as follows:
 KING 7839
    BLAKE 7698

      ALLEN 7499 
      JAMES 7900      
      MARTIN 7654 
      TURNER 7844 
      WARD 7521 
    CLARK 7782 
      MILLER 7934
    JONES 7566 
      FORD 7902 
        SMITH 7369 
      SCOTT 7788 
        ADAMS 7876 

Is this possible with Oracle SQL and ReportWriter 1.1? Is there some kind of method for printing all the rows both in hierarchical and alphabetical order.

Many thanks in advance,

Jari Received on Fri Jan 13 1995 - 13:08:09 CET

Original text of this message