Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PLSQL: variable in FOR loop
first : no more then one value in your variable,
second : no need for parentheses with your loop
In article <35c6051d.7289401_at_gateway.northgrum.com>, iluvpets_at_iname.com says...
>
>The following code is a simple loop that works as advertised:
>FOR cnty IN (SELECT DISTINCT country FROM cities ORDER BY 1)
>LOOP
> .. do some stuff ..
>END LOOP;
>
>I need to make the SQL a touch dynamic, so I tried the following:
>vSQL VARCHAR2(100);
>BEGIN
>vSQL := 'SELECT DISTINCT country FROM cities ORDER BY 1';
>FOR cnty IN (vSQL)
>LOOP
> .. do some stuff ..
>END LOOP;
>
>And I get the following:
>PLS-00103: Encountered the symbol "LOOP" when expecting one of the
>following: * & - + / mod rem .. an exponent (**) ||
>
>Ouch! Is this possible?
>Thanks very much
>Mark
>mark_aurit ATSIGN mail.northgrum.com
Received on Tue Aug 04 1998 - 18:00:44 CDT
![]() |
![]() |