Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: for loop in PL/SQL
On Thu, 26 Aug 1999 23:50:39 GMT, Nandakumar <N.Kumar_at_rocketmail.com> wrote:
>
>
>Is there a way in PL/SQL to loop thru' a varchar2 list.
>
>Currently, the following snippet of code
>
>for count 1..5
>loop
>end loop; is valid in PL/SQL; count being an integer.
>
>i want to do similar thing with a list of varchar2 fields like
>
>for value in 'A' 'B' 'C'
>loop
>end loop;
you could use a pl/sql table
1 declare
2 type myTable is table of varchar2(2000) index by binary_integer;
3 list myTable;
4 begin
5 list(1) := 'A'; 6 list(2) := 'B'; 7 list(3) := 'C'; 8 for i in 1 .. list.count loop 9 --do stuff to list(i); 10 null;
>
>how can i do this? Any suggestions???
>
>
>thanks
>Nanda
--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.