SORTING WITHIN HIERARCHY REPORTS

From: <magc_at_vms.cis.pitt.edu>
Date: 1995/05/05
Message-ID: <3oe1c8$60q_at_usenet.srv.cis.pitt.edu>#1/1


Does anyone know how to sort the descendants within a hierarchy report created with the CONNECT BY clause? For example (from page 4-364 of SQL Language Reference Manual):

     SELECT ename, empno, mgr, job
       FROM emp
     START WITH job = 'PRESIDENT'
     CONNECT BY PRIOR ename = mgr

returns the following:
   KING          7839          PRESIDENT
     JONES       7566    7839  MANAGER
       SCOTT     7788    7566  ANALYST
         ADAMS   7876    7788  CLERK
       FORD      7902    7566  ANALYST
         SMITH   7369    7902  CLERK
     BLAKE       7698    7839  MANAGER
       ALLEN     7499    7698  SALESMAN

.
.
.
    

I would like to sort the descendants and return the following:

   KING          7839          PRESIDENT
     BLAKE       7698    7839  MANAGER
       ALLEN     7499    7698  SALESMAN
     JONES       7566    7839  MANAGER
       FORD      7902    7566  ANALYST
         SMITH   7369    7902  CLERK
       SCOTT     7788    7566  ANALYST
         ADAMS   7876    7788  CLERK


Any help will be appreciated. Received on Fri May 05 1995 - 00:00:00 CEST

Original text of this message