Re: Collection Help
From: dombrooks <dombrooks_at_hotmail.com>
Date: Wed, 14 Mar 2012 15:33:33 -0700 (PDT)
Message-ID: <10609703.7183.1331764413484.JavaMail.geo-discussion-forums_at_ynnk21>
The FOR LOOP with FIRST and LAST a) only works for index-by integers and b) is not great for sparse collections.
END LOOP;
...
END; Received on Wed Mar 14 2012 - 17:33:33 CDT
Date: Wed, 14 Mar 2012 15:33:33 -0700 (PDT)
Message-ID: <10609703.7183.1331764413484.JavaMail.geo-discussion-forums_at_ynnk21>
The FOR LOOP with FIRST and LAST a) only works for index-by integers and b) is not great for sparse collections.
A WHILE loop that iterates through the collection using .NEXT suits all scenarios.
e.g. something like:
DECLARE
...
idx VARCHAR2(30);
...
BEGIN
idx := v_order_tab.FIRST;
WHILE (idx IS NOT NULL)
LOOP
... idx := v_order_tab.NEXT(idx);
END LOOP;
...
END; Received on Wed Mar 14 2012 - 17:33:33 CDT