Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: for loop in PL/SQL

Re: for loop in PL/SQL

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Fri, 27 Aug 1999 14:47:31 GMT
Message-ID: <37c7a227.256226754@inet16.us.oracle.com>


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;

 11 end loop;
 12* end;

>
>how can i do this? Any suggestions???
>
>
>thanks
>Nanda

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Aug 27 1999 - 09:47:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US