Tom Kite from one hundred fame answered this question more firmly. If you want to do some searching, you can find a question and answer that contains detailed test results and explanations. It shows the cursor plsql vs. plsql bulk collect, including the effect of periodic commit, as well as the sql tab as a choice.
Paste, because the choice wins by hand all the time, and the difference even on modest data sets is dramatic.
That said. previously a comment was made on the complexity of intermediate calculations. I can think of three situations where this would be relevant.
1) If the calculations require going beyond the limits of the Oracle database, it is clear that a simple insert as an option does not do the trick.
2) If the solution requires the use of PLSQL function calls, then context switching can potentially kill your query, and you may have better results when calling plsql functions called by plsql. PLSQl was made to invoke SQL, but not vice versa. Thus, calling PLSQL from SQL is expensive.
3) If the calculations make the sql code very difficult to read, although although it may be slower, the solution for collecting the sum of plsql may be better for these other reasons.
Good luck.
source share