oracle dynamic cursor for loop example
-- open the cursor and then fetch and count every row
DECLARE
CURSOR c IS SELECT * FROM emp;
cursor_count c%ROWTYPE;
totalrows NUMBER;
BEGIN
OPEN c;
LOOP
FETCH c INTO cursor_count;
dbms_output.put_line('names' || cursor_count.ename);
EXIT WHEN c%NOTFOUND;
END LOOP;
totalrows := c%ROWCOUNT;
dbms_output.put_line('total rows' || totalrows);
END;