Cursor students(gr VARCHAR2) IS
SELECT * FROM v_student WHERE gr_name = gr;
i students%ROWTYPE;
––kursorning har bir satri uchun %ROW tipidan foydalanildi
BEGIN
OPEN students('AT–30');
LOOP
FETCH students into i;
EXIT WHEN students%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(i.name||chr(9)||i.gr_name);
END LOOP;
CLOSE students;
END;
Kursorni FOR operatori bilan qo‘llash:
Declare
CURSOR cur2(gr NUMBER :=2) IS
SELECT * FROM student1 WHERE id_group = gr;
BEGIN
FOR i IN cur2(2) LOOP
DBMS_OUTPUT.PUT_LINE(i.name||chr(9)||i.id_group);
END LOOP;
END;