Of course, it ain't pretty, folks:
In Perl:
my @items = qw(item1 item2);
foreach my $item (@items)
{
take_action($item);
}
In PL/SQL:
DECLARE
TYPE items_t IS TABLE OF VARCHAR2(80); -- note the strong typing constraint
items items_t:= items_t('item1', 'item2');
items_index NUMBER:= 1;
BEGIN
<<items_loop>>
WHILE items_index IS NOT NULL
LOOP
DECLARE
item VARCHAR2(80):= items(items_index);
BEGIN
take_action(item);
items_index:= items.NEXT(items_index);
END;
END LOOP items_loop;
END;
/
Repeat (Score:2)
Note: this version [perl.org] has better syntax.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers