SET SERVEROUTPUT ON
DECLARE
TYPE ref_emp_cursor IS REF CURSOR;
emp_cur ref_emp_cursor;
l_deptno dept.deptno%TYPE;
l_ename emp.ename%TYPE;
CURSOR c1 IS SELECT deptno,
CURSOR(SELECT e.ename FROM emp e
WHERE e.deptno = d.deptno)
FROM dept d where d.dname like 'A%';
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO l_deptno, emp_cur;
EXIT WHEN c1%NOTFOUND;
dbms_output.put_line('Department No '||l_deptno);
dbms_output.put_line('========================');
LOOP
FETCH emp_cur INTO l_ename;
EXIT WHEN emp_cur%NOTFOUND;
dbms_output.put_line(emp_cur%ROWCOUNT||' Employee name is '||l_ename);
END LOOP;
END LOOP;
CLOSE c1;
END;
/
Department No 10
========================
1 Employee name is CLARK
2 Employee name is KING
3 Employee name is MILLER
Subscribe to:
Post Comments (Atom)
External Table
Oracle External Table External tables are defined as tables that do not resides in the database allows you to access data that is stor...
-
Table clustering is an optional technique of storing data. In table clustering, rows from one or more tables those are associated with ea...
-
Oracle PL/SQL block accepts user input information with the help of substitution variable. Substitute variable can not be used to output va...
-
Finally continue statement added to oracle 11g PL/SQL language. It signals an immediate end to a loop iteration and return to first statemen...
No comments:
Post a Comment