Table of Contents

About

Unlike an cursor variable, which refers to different work areas, a explicit cursor refer always to the same query.

Initialization

Simple

DECLARE
   CURSOR Vc_emp IS SELECT * FROM EMP;
BEGIN
  ...
END;

Parameterized

CURSOR low_paid (num PLS_INTEGER) IS
  SELECT empno 
    FROM emp
   WHERE rownum <= num
ORDER BY sal ASC;

Management

Loop

OPEN myCursor;
LOOP
  FETCH myCursor INTO myRecord;
  EXIT WHEN myCursor%NOTFOUND;
END LOOP;
CLOSE myCursor;

where: