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
What is difference between nchar and nvarchar?
What is procedure in pl sql?
What does fetching a cursor do?
What is the most restrictive isolation level? : Transact sql
What does the base_object_type column shows in the user.triggers data dictionary view?
What is bulk collect in pl sql?
Is postgresql a nosql database?
Explain the rollback statement?
What are sql injection vulnerabilities?
What is aggregate function in sql?
Name the different types of indexes in sql and define them.
Are sql connections encrypted?
How can we implement rollback or commit statement in a trigger?
what is 'trigger' in sql? : Sql dba
what are the 'mysql' command line options? : Sql dba