PL/SQL - Explicit cursor

Card Puncher Data Processing

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:





Discover More
Card Puncher Data Processing
PL/SQL - Cursor

A cursor in the context of Oracle. A cursor is a SQL datatype. A cursor is a pointer to a private SQL area that stores information processing a specific: SELECT or DML statement. The cursor data...
Card Puncher Data Processing
PL/SQL - Cursor Variables (also known as REF CURSORs)

With 7.2 on up of the database you have cursor variables. Cursor variables are cursors opened by a pl/sql routine and fetched from by another application or pl/sql routine. The cursor variables are...



Share this page:
Follow us:
Task Runner