Hi fras85,
you only have to open and close explicit cursors. Implicit cursors have the advantage of being managed automatically by Oracle. Example of implicit cursors:
DECLARE
l_dept dept%rowtype;
BEGIN
-- implicit SELECT INTO
SELECT * INTO l_dept FROM dept WHERE deptno = :deptno;
-- implicit LOOP
FOR cc IN (SELECT emp.* FROM emp WHERE deptno = l_dept.deptno) LOOP
dbms_output.put_line('emp='||cc.empno);
END LOOP;
END;
/
Implicit cursors are more concise in the code, you don't have to worry about closing them. I also find it clearer to have the code of the cursor where it is actually used. I seldom use explicit cursor, and only if they can be reused in many places in a package (then why not put it in a single proc?).