Home » SQL & PL/SQL » SQL & PL/SQL » regarding SQL query + unix Script (oracle 10g)
regarding SQL query + unix Script [message #399197] Tue, 21 April 2009 01:56 Go to next message
vamsikrishnag
Messages: 16
Registered: October 2008
Junior Member
Hi,

EMP TABLE:

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
==================================================================
7369 SMITH CLERK 7902 12/17/1980 800 20
7499 ALLEN SALESMAN 7698 2/20/1981 1600 300 30
7521 WARD SALESMAN 7698 2/22/1981 1250 500 30
7566 JONES MANAGER 7839 4/2/1981 2975 20
7654 MARTIN SALESMAN 7698 9/28/1981 1250 1400 30
7698 BLAKE MANAGER 7839 5/1/1981 2850 30
7782 CLARK MANAGER 7839 6/9/1981 2450
7788 SCOTT ANALYST 7566 12/9/1982 3000 20
7839 KING PRESIDENT 11/17/1981 5000
7844 TURNER SALESMAN 7698 9/8/1981 1500 0 30
7876 ADAMS CLERK 7788 1/12/1983 1100 20
7900 JAMES CLERK 7698 12/3/1981 950 30
7902 FORD ANALYST 7566 12/3/1981 3000 20
7934 MILLER CLERK 7782 1/23/1982 1300
================================================================

I would like the output group by manger and the employees under that manager using analytic functions.

Output should look like:

ManagerName EMPNAME
==========================================================
KING JONES,BLAKE,CLARK
JONES SCOTT,FORD
BLAKE ALLEN,WARD,MARTIN,TURNER,JAMES
CLARK MILLER
FORD SMITH
SCOTT ADAMS

Also I would like to run this query in unix shell script in order to create a folder structure like this:

Root Folder: King -> Jones -> SCOTT -> ADAMS
-> FORD -> SMITH

-> BLAKE -> ALLEN
-> WARD
-> MARTIN
-> TURNER
-> JAMES

-> CLARK -> MILLER

On a total 14 folders should be created.

Thanks in Advance
G.Vamsi Krishna
Re: regarding SQL query + unix Script [message #399199 is a reply to message #399197] Tue, 21 April 2009 02:03 Go to previous messageGo to next message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ Search for pivot
2/ This is not an Oracle question but a Unix one so you should post it in a Unix forum.

In addition, Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: regarding SQL query + unix Script [message #399207 is a reply to message #399197] Tue, 21 April 2009 02:13 Go to previous message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And DON'T multipost/crosspost your questions.

Regards
Michel
Previous Topic: Differnece between Varchar2 and CHAR
Next Topic: need to write user defined function on group by clause
Goto Forum:
  


Current Time: Wed Dec 07 02:49:18 CST 2016

Total time taken to generate the page: 0.12544 seconds