Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: loop
"Karen Abgarian" <abvk_at_ureach.com> wrote in
message news:3D4C4CCF.774D8DE_at_ureach.com...
> > You'll find a lot of people saying that
explicity declaring cursors is
> > faster than not, ie they will claim that
> >
> > cursor X is select ...
> > open
> > fetch
> > close
> >
> > is faster then
> >
> > select ..
> > into variable
> > from table
> >
> > Ask them to prove it...they'll struggle :-)
> >
> > hth
> > connor
> > --
> > ==============================
> > Connor McDonald
> >
> > http://www.oracledba.co.uk
> >
> > "Some days you're the pigeon, some days you're
the statue..."
>
> I think Jonathan Lewis was saying this in his
book.
>
> The idea is that for the second one, Oracle has
to make sure that the
> second row is NOT returned from the query,
because an
> TOO_MANY_ROWS exception is also some piece of
information
> that can be returned from the query. The first
just does a single fetch,
> the second does two.
>
> IMO makes a lot of sense
>
I believe neither implicit nor explicit cursors
will
raise an too_many_rows exception.
One will need to test the %[NOT]FOUND boolean
(with or
without the SQL in front).
Oracle will attemp two fetches when one
issues a select ... into, which is not part of a
cursor,
and raise to_many_rows accordingly.
and far as I have read lately, then most people
vote for
the cursor for loop.
Regards,
Keld
Received on Mon Aug 05 2002 - 13:38:04 CDT