Yesterday I asked a question on how to re-write sql to do selects and inserts in batches. I needed to do this to try and consume less virtual memory, since I need to move millions of rows here.
The object is to move rows from Table B into Table A. Here are the ways I can think of doing this:
SQL #1)
INSERT INTO A (x, y, z)
SELECT x, y, z
FROM B b
WHERE ...
SQL #2)
FOREACH SELECT x,y,z INTO _x, _y, _z
FROM B b
WHERE ...
INSERT INTO A(_x,_y,_z);
END FOREACH;
Are any of the above incorrect? The database is informix 11.5.
UPDATE:
Turns out something else was causing IDS to consume crazy amounts of memory. The code above, was causing the memory to cross the allotted threshold. At this point, I don't see the point of using one method over the other.