The use of cursors Cursor in Oracle is very useful for traversing query results in temporary tables.
Query "ename" and "deptno" in the emp table and store them in the cusor_01 cursor. The for loop iterates the cursor collection. The result of each iteration is stored in 'c'.
create or replace procedure test01 is cursor cusor_1 is select ename,deptno from emp ;--Define a cursor begin for c in cusor_1 loop dbms_output.put_line('Employee name:'||c.ename||' Department number:'||c.deptno); end loop; end test01;