I am trying to update two tables by inserting some rows into the other. But when I try to do something like this :
BEGIN
FOR id IN (SELECT id FROM table1) LOOP
PERFORM (INSERT INTO anothertable VALUES(id));
END LOOP;
END;
It gives an error I don't know why. syntax error at or near "INTO"
.
Is it even possible to do such thing without cursors and such updating one by one ?