how to get enames with comma seperated values by deptwise
on emp table?

Answer Posted / pradeep

select deptno,cursor (select ename ,deptno from emp where
d.deptno = deptno ) from dept d

1* select deptno,cursor (select
SQL> /

DEPTNO CURSOR(SELECTENAME,D
---------- --------------------
10 CURSOR STATEMENT : 2

CURSOR STATEMENT : 2

ENAME DEPTNO
---------- ----------
CLARK 10
KING 10
MILLER 10

20 CURSOR STATEMENT : 2

CURSOR STATEMENT : 2

ENAME DEPTNO
---------- ----------
PORT NO 20
SMITH 20
JONES 20
SCOTT 20
ADAMS 20
FORD 20

6 rows selected.

30 CURSOR STATEMENT : 2

CURSOR STATEMENT : 2

ENAME DEPTNO
---------- ----------
ALLEN 30
WARD 30
MARTIN 30
BLAKE 30
TURNER 30
JAMES 30

6 rows selected.

40 CURSOR STATEMENT : 2

CURSOR STATEMENT : 2

no rows selected

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is identity column in sql server?

525


How do you rename a table in sql?

528


What is 19 null in sql?

528


What is the use of sql trace?

472


How show all rows in sql?

604






which types of join is used in sql widely? : Sql dba

535


What is delete command in sql?

554


What are the different sql languages?

536


What has stored procedures in sql?

593


How can get second highest salary in sql?

501


Is time a data type in sql?

474


What is a unique constraint?

606


Why join is faster than subquery?

597


how would you get the current date in mysql? : Sql dba

535


What is date functions?

571