PL/SQL (MOSC)

MOSC Banner

BULK COLLECT FORALL .... Failed in Oracle 19c :(

edited Feb 7, 2025 8:53AM in PL/SQL (MOSC) 12 commentsAnswered

Hello,
I have to insert 4G of data into an empty table, so I used this procedure:

SET SERVEROUTPUT ON

DECLARE

TYPE tab_table1 IS TABLE OF Table1%ROWTYPE;

l_DATA_INSERT tab_table1 := tab_table1();

BEGIN

SELECT col1, col2,col3
BULK COLLECT INTO l_DATA_INSERT
FROM Table1;

FORALL i IN 1 .. l_DATA_INSERT.COUNT
INSERT INTO Table2
SELECT * FROM Table3 ps
WHERE ps.col1 = l_DATA_INSERT(i).col1
AND ps.col2= l_DATA_INSERT(i).col2
AND ps.col3= l_DATA_INSERT(i).col3

COMMIT;

EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('CODE ERROR :' || SQLCODE||'-'||SQLERRM);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center