There is simplified syntax you can use that avoids having to deal with cursors directly. I think it's less error-prone this way.
Example:
begin
for rec in (
select rn, salary
from (
select rownum as rn, salary
from employees
) where rn between 80 and 100
) loop
dbms_output.put_line(to_char(rec.rn) || rec.salary);
end loop;
end;
/
Documentation: Query Result Set Processing With Cursor FOR LOOP Statements
EDIT:
The general form of this construct is:
begin
for rec in (
select * from employees -- write any SQL you want here
) loop
-- do whatever you need to do inside the loop...
-- you can access the results of the query through the "rec" variable.
dbms_output.put_line(rec.column1);
dbms_output.put_line(rec.column2);
dbms_output.put_line(rec.column3);
end loop;
end;
/