## "Explicit" verses "implicit" SQL cursors

    DECLAR
      CURSOR C1 IS
	SELECT E.dept_no, 
	       E.category, 
	       D.description, 
	       count(*)
	FROM   dept D, 
	       emp E
	WHERE  D.dept_no = E.dept_no
	GROUP
	    BY E.dept_no, 
	       E.category, 
	       D.description;
    BEGIN
	for XX in C1 loop
	    ...
	    ...
	end loop;
    END;



    DECLARE
	Xdept  number;
	Xdesc  varchar2(60);

	CURSOR C1 IS
	SELECT E.dept_no, 
	       E.category 
	       count(*)
	FROM   emp E
	GROUP
	    BY E.dept_no, 
	       E.category; 
	CURSOR C2 IS
	SELECT D.description 
	FROM   dept D
	WHERE  D.dept_no = Xdept;
    BEGIN
	for XX in C1 loop
	    ...
	    Xdept := XX.dept_no;
	    Open  C2;
	    Fetch C2 into Xdesc;
	    ...
	end loop;
    END;



    DECLARE
	Xdept  number := -9999;
	Xdesc  varchar2(60);
	CURSOR C1 IS
	SELECT E.dept_no, 
	       E.category 
	       count(*)
	FROM   emp E
	GROUP
	    BY E.dept_no, 
	       E.category; 

	CURSOR C2 IS
	SELECT D.description 
	FROM   dept D
	WHERE  D.dept_no = Xdept;
    BEGIN
	for XX in C1 loop
	    ...
	    if Xdept != XX.dept_no
	       Xdept := XX.dept_no;
	       Open  C2;
	       Fetch C2 into Xdesc;
	    end if;
	    ...
	end loop;
    END;