Answers for "open loop fetch oracle cursor"

SQL
4

oracle cursor for loop fetch

-- open the cursor and then fetch and count every row
DECLARE
    CURSOR c IS SELECT * FROM emp;
    cursor_count c%ROWTYPE;
    totalrows    NUMBER;
BEGIN
    OPEN c;
    LOOP
        FETCH c INTO cursor_count;
        dbms_output.put_line('names' || cursor_count.ename);
        EXIT WHEN c%NOTFOUND;
        END LOOP;
    totalrows := c%ROWCOUNT;
    dbms_output.put_line('total rows' || totalrows);
END;
Posted by: Guest on April-26-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language