== Why is this an issue? Using ``++FORALL i IN x.first ... x++``.last or ``++FORALL i IN 1 ... x.count++`` might fail when indexed collections are sparse as Oracle tries to access non-existent element(s) of x. ``++FORALL i IN INDICES OF x++`` syntax will always work including sparse collections. Thus using ``++FORALL i IN INDICES OF x++`` should be preferred as it makes code more robust and easier to review. === Noncompliant code example [source,sql] ---- FORALL i IN 1 .. l_tab.COUNT -- Non-Compliant INSERT INTO forall_test VALUES l_tab(i); FORALL i IN l_tab.first .. l_tab.last -- Non-Compliant INSERT INTO forall_test VALUES l_tab(i); ---- === Compliant solution [source,sql] ---- FORALL i IN INDICES OF l_tab INSERT INTO forall_test VALUES l_tab(i); ---- == Resources * https://asktom.oracle.com/Misc/oramag/oracle-10g-adds-more-to-forall.html[Oracle 10g Adds More to FORALL] * https://stevenfeuersteinonplsql.blogspot.com/2019/03/using-sparse-collections-with-forall.html[Using sparse collections with FORALL] - Steven Feuerstein ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Replace "IN ..." with "INDICES OF ..." === Highlighting * ``++IN x.first ... x.last++`` * ``++1 ... x.count++`` endif::env-github,rspecator-view[]