DEV Community

Discussion on: Optimize multiple INSERTs (for Oracle)

Collapse
 
mohan734 profile image
Mohan

Good One. it really helped to boost performance of an INSERT operation. is there any way for UPDATE as well similar to it?

Collapse
 
michelc profile image
Michel

Yes, it works for everything. The BEGIN / END block can contain all kinds of queries:

BEGIN
  UPDATE MyTable SET Column4 = Column4 + 1 WHERE Column1 = 'One_1';
  UPDATE MyTable SET Column4 = Column4 + 2 WHERE Column1 = 'One_2';
  UPDATE MyTable SET Column4 = Column4 + 3 WHERE Column1 = 'One_3';
  etc...
END;
Enter fullscreen mode Exit fullscreen mode