I am working on a database migration in which we migrate data from 1 table to 2 other tables. For this I use a PL/SQL script. A very simplified version of the script is visible below:
- BEGIN
- FOR foo IN (SELECT * FROM FOO) LOOP
- INSERT INTO BAR (ID, STATUS)
- VALUES (foo.ID, foo.STATUS);
- FOR foolog IN (SELECT * FROM FOO_LOG where ID = foo.ID) LOOP
- INSERT INTO BAR_LOG (ID, REV);
- VALUES (FOO_SEQ.CURRVAL, foolog.REV);
- END LOOP;
- END LOOP;
- END;
Any clue of why this happens/how to solve this?