Hi All,

Have a question related to FORALL Bulk Update:

I have a similar code as below -

DECLARE
    CURSOR rec_cur IS
    SELECT *
    FROM test4;

    TYPE num_tab_t IS TABLE OF NUMBER(38);
    TYPE vc2_tab_t IS TABLE OF VARCHAR2(4000);

    pk_tab NUM_TAB_T;
    fk_tab NUM_TAB_T;
    fill_tab VC2_TAB_T;
BEGIN
    OPEN rec_cur;
    LOOP
        FETCH rec_cur BULK COLLECT INTO pk_tab, fk_tab, fill_tab LIMIT
100000;
        EXIT WHEN pk_tab.COUNT() = 0;

        FORALL i IN pk_tab.FIRST .. pk_tab.LAST
           UPDATE test
            SET    fk = fk_tab(i)
            ,      fill = fill_tab(i)
            WHERE  pk = pk_tab(i);

        DBMS_OUTPUT.put_line('Updated '|| pk_tab.count || ' rows of test4
table');

        commit;

    END LOOP;
    CLOSE rec_cur;
    commit;
END;
/

There are totally 531503 row to update.

Even though dbms output show that it updated all the rows.

Update 100000 rows of adjitem table
Update 100000 rows of test4 table
Update 100000 rows of test4 table
Update 100000 rows of test4 table
Update 100000 rows of test4 table
Update 31503 rows of test4 table

There are some records those didn't get updated.

1st execution didn't update 27893 rows
2nd execution didn't update 1573 rows
2rd execution didn't update 3 rows

What would be the reason, that its not updating everything in first
execution?

Thanks in advance!
G

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Oracle PL/SQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to oracle-plsql+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to