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: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sat, 03 Aug 2002 10:24:52 +0100
Message-ID: <3D4BA164.67D9@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

  1. its simpler to read
  2. its less code
  3. 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;

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Sat Aug 03 2002 - 04:24:52 CDT

Original text of this message

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