oracle cursor for loop fetch

Solutions on MaxInterview for oracle cursor for loop fetch by the best coders in the world

showing results for - "oracle cursor for loop fetch"
Giulia
27 Nov 2020
1-- open the cursor and then fetch and count every row
2DECLARE
3    CURSOR c IS SELECT * FROM emp;
4    cursor_count c%ROWTYPE;
5    totalrows    NUMBER;
6BEGIN
7    OPEN c;
8    LOOP
9        FETCH c INTO cursor_count;
10        dbms_output.put_line('names' || cursor_count.ename);
11        EXIT WHEN c%NOTFOUND;
12        END LOOP;
13    totalrows := c%ROWCOUNT;
14    dbms_output.put_line('total rows' || totalrows);
15END;