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: continue in for loop

Re: continue in for loop

From: Kenneth C Stahl <BluesSax_at_Unforgettable.com>
Date: Fri, 23 Jul 1999 08:50:56 -0400
Message-ID: <37986530.2EE47F72@Unforgettable.com>


Anurag Minocha wrote:

> Hi,
> I have a small doubt. Does oracle pl/sql has something like CONTINUE
> for a FOR LOOP like other languages as C++ has. If not how do i do the
> particular in the best possible way
>
> Thanks
> anurag

Do it like this:

declare

    cursor c1 is
    select col1,

              col2
   from mytable;
begin

    for i in c1 loop

        if i.col1 = 'somevalue' then
        goto end_of_loop;
        end if;
        -- put additional processing here as needed
        <<end_of_loop>>
        null;

    end loop;
end;

You will probably see others who respond to this message saying "never do that - goto's should never be used" - just ignore them. They do not know what they are talking about.

Ken Received on Fri Jul 23 1999 - 07:50:56 CDT

Original text of this message

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