PL/SQL does not have any practical limit on the number of iterations in a loop.
I can't prove it but here are my reasons for saying there is no limit:
- No limit is listed in the PL/SQL Program Limits section of the Database PL/SQL Language Reference. One thing Oracle is usually good at is keeping the hard limits to a minimum or always having a workaround.
- Creating a limit like this in a programming language doesn't make sense.
- One reason I started concentrating on Oracle SQL and PL/SQL many years ago was to avoid a programming language that had an iteration limit. Few programming problems are more depressing than an error like "maximum loop limit exceeded". If this problem existed in PL/SQL a lot of people would know and be angry about it.
At some point every loops dies - you'll run out of a resource. But for a sane language like PL/SQL you can worry more about cosmic rays.
Perhaps by "limit" you mean the LIMIT
bulk collect option? If so, Oracle cursor-FOR loops use a limit of 100. Which means it will fetch 100 rows at a time. This is a good trade-off between memory and reducing overhead and in practice is always good enough.
As a_horse_with_no_name suggested, avoiding loops completely is a best practice in Oracle SQL. Set based programs are almost always faster than row-by-row.