DECLARE

CURSOR C1(R NUMBER) IS SELECT * FROM SAILORS WHERE RATING=R;

I INTEGER;

BEGIN

FOR I IN 1..10 LOOP

DBMS_OUTPUT.PUT_LINE('SAILORS WITH RATING '|| I || ' ARE');

DBMS_OUTPUT.PUT_LINE('SID NAME AGE');

FOR Z IN C1(I) LOOP

/* Itβ€˜s not compulsory to define variable using rowtype for simple cursor as well as for update cursor */

DBMS_OUTPUT.PUT_LINE(Z.SID ||' ' ||Z.SNAME ||' '||Z.AGE);

END LOOP;

END LOOP;

END;

/





 create table sailors (sid integer,sname varchar2(30),rating integer,age real,primary key (sid));

οƒ˜ insert into sailors values(22, 'dustin',7,45.0);

οƒ˜ insert into sailors values(31, 'lubber',8,55.5);

οƒ˜ insert into sailors values(58, 'rusty', 10, 35.0);