Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Query Question

Re: Query Question

From: mike <hillmw_at_charter.net>
Date: 11 Mar 2005 09:43:27 -0800
Message-ID: <1110563007.190233.249590@g14g2000cwa.googlegroups.com>


So, you are suggesting I create a sql loop. The example they gave was:

	DECLARE
	   CURSOR dept_cur IS
	   SELECT deptno
	     FROM dept
	    ORDER BY deptno;
	   -- Employee cursor all employees for a dept number
	   CURSOR emp_cur (v_dept_no DEPT.DEPTNO%TYPE) IS
	   SELECT ename
	     FROM emp
	    WHERE deptno = v_dept_no;
	BEGIN
	   FOR dept_rec IN dept_cur LOOP
	      dbms_output.put_line('Employees in Department
'||TO_CHAR(dept_rec.deptno));
	      FOR emp_rec in emp_cur(dept_rec.deptno) LOOP
	         dbms_output.put_line('...Employee is '||emp_rec.ename);
	      END LOOP;
	  END LOOP;
	END;
Received on Fri Mar 11 2005 - 11:43:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US