Here is a PL/SQL program to demonstrate cursors:
DECLARE
CURSOR emp_cursor IS
SELECT empno, ename FROM employee;
BEGIN
FOR emp_record IN emp_cursor LOOP
DBMS_OUTPUT.PUT_LINE(emp_record.empno || ' ' || emp_record.ename);
END LOOP;
END;
/
This program declares a cursor called emp_cursor that selects the empno and ename columns from the employee table. It then uses a FOR loop to iterate through the cursor, outputting the empno and ename on each row. This demonstrates how to declare and use a cursor to process multiple rows of data from a table in PL/SQL