Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Hierachical SELECT
Decode function may helps.
SQL> l
1 select EMPNO,ENAME,JOB,mgr, 2 decode(mgr,'7902','FORD', 3 '7698','BLAKE', 4 '7839','KING', 5 '7566','JONES', 6 '7788','SCOTT', 7 '7782','CLARK')
7369 SMITH CLERK 7902 FORD 7499 ALLEN SALESMAN 7698 BLAKE 7521 WARD SALESMAN 7698 BLAKE 7566 JONES MANAGER 7839 KING 7654 MARTIN SALESMAN 7698 BLAKE 7698 BLAKE MANAGER 7839 KING 7782 CLARK MANAGER 7839 KING 7788 SCOTT ANALYST 7566 JONES 7839 KING PRESIDENT 7844 TURNER SALESMAN 7698 BLAKE 7876 ADAMS CLERK 7788 SCOTT 7900 JAMES CLERK 7698 BLAKE 7902 FORD ANALYST 7566 JONES 7934 MILLER CLERK 7782 CLARK
14 rows selected.
SQL>
In article <3755C067.2EDE9D5C_at_easynet.co.uk>,
Rose Noel <rkamene_at_easynet.co.uk> wrote:
> Hello everybody,
> I am trying to select some employee data from emp table without using
> the "CONNECT BY CLAUSE". Is it this possible using only SQL.
> Empno Ename Mgr
> 7765 Scott 7788
> 7788 Jones 7839
>
> This is the result of executing the query. I know Scott's EMPNO and I
> want his details and that of his manager. How can this be done in sql
> Cheers
> RNK.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Wed Jun 02 1999 - 21:19:51 CDT
![]() |
![]() |