Answers for "for loop with cursor in oracle"

SQL
4

oracle dynamic cursor for loop example

-- 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