I’d like to loop through a list of strings and execute a function/procedure with each string as the argument.
What’s the best alternative to the following generic code (since it’s not legal):
set serveroutput on;
begin
FOR r IN ('The', 'Quick', 'brown', 'fox')
LOOP
dbms_output.put_line( r );
END LOOP;
end;
I assume there might be pattern for this.
Just for completeness, a pure PL/SQL solution.
This uses the preclared
sys.dbms_debug_vc2colldatatype, which has quite a generous definition …… so, like Gary says, you may wish to declare your own. Especially if your strings are short and you have lots of them.