Methods of Opening a parametric Cursor.

0
Methods of Opening a parametric Cursor:
1.Open Empcursor(30,’SALESMAN’);
2.DECLARE
   v_empdeptno Emp.deptno%TYPE:=&Givedeptno;
   v_empjob Emp.job%TYPE:=&GiveJob;
  BEGIN
   OPEN Empcursor(v_empdeptno,v_empjob);


3.DECLARE
  CURSOR Empcursor
        (Pdeptno NUMBER,
        Pjob VARCHAR2) IS
  SELECT empno,ename
  FROM emp
  WHERE deptno=Pdeptno AND job=Pjob;
  BEGIN
  FOR Emprecord IN Empcursor(20,’CLERK’)
  LOOP


Import Points:

  • Unless you want to accept default values, each formal parameter in the cursor declaration must have a corresponding actual parameter in the OPEN statement.
  • A parametric cursor can be opend and closed explicitly several times in a PL/SQL block.
  • A parametric cursor returns a different Active set on each occasion.
  • The concept is more useful when the same cursor is referenced repeatedly.

 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