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: loop

Re: loop

From: Stjepan Brbot <stjepan.brbot_at_zg.hinet.hr>
Date: Sat, 3 Aug 2002 22:12:17 +0200
Message-ID: <aiilug$72sb$1@as201.hinet.hr>


"Connor McDonald" <connor_mcdonald_at_yahoo.com> wrote in message news:3D4BA164.67D9_at_yahoo.com...
> Stjepan Brbot wrote:
> >
> > What is better:
> >
> > FOR xy IN curXY LOOP
> > ...
> > END LOOP;
> >
> > or
> >
> > OPEN curXY;
> > LOOP
> > FETCH curXY INTO xy;
> > IF curXY%NOTFOUND THEN
> > EXIT;
> > END IF;
> > ...
> > END LOOP;
> >
> > --
> >
> > Stjepan Brbot

>

> The first because
>

> a) its simpler to read
> b) its less code
> c) its faster
>

> If you don't need any cursor attributes through the loop, you can also
> code
>

> for i in ( select ...
> from ... ) loop
> ...
> end loop;

I thought that too becuse this is the same situation like with FOR..NEXT vs. WHILE..WEND loops in other programming languages. But I wasn't sure because I had found a lot of code from very expirienced developers using the second way with %NOTFOUND.

--

Stjepan Brbot
Received on Sat Aug 03 2002 - 15:12:17 CDT

Original text of this message

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