Explicit Cursor and Implicit FOR Loops

0
Explicit Cursor and Implicit FOR Loops:
Explicit Cursor:
  • An EXPLICT CURSOR is generated using a name with association of select statement in  the DECLARE section of the PL/SQL block.
Advantages:
  • Explicit cursor provide more programmatic control for programmers.
  • Explicit cursor are more efficient in implementation, hence easy to trap errors.

Implicit FOR Loops:
  • Write a PL/SQL Implicit cursor to insert the employee details into the bonus table.

SQL>DECLARE
    FOR v_Empdate IN(SELECT ename, job, sal, comm.
FROM emp
WHERE deptno=30)
    LOOP
    INSERT INTO bonus
    VALUES(v_Empdata.ename,v_Empdate.job,v_Empdata.sal,v_Empdata.comm);
    END LOOP;
    END;


 Click here to go to Back page

About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts