My mantra, that I'll be sticking with thank you very much, is:
1.You should do it in a single SQL statement if at all possible.
2.If you cannot do it in a single SQL Statement, then do it in PL/SQL.
3.If you cannot do it in PL/SQL, try a Java Stored Procedure.
4.If you cannot do it in Java, do it in a C external procedure.
5.If you cannot do it in a C external routine, you might want to seriously think about why it is you need to do it…
think in sets...