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: Implicit vs. Explicit cursors

Re: Implicit vs. Explicit cursors

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: 2000/05/30
Message-ID: <3933BF84.46C57CCC@Unforgettable.com>#1/1

Dave Wotton wrote:
>
> Kenneth C Stahl wrote in message <392E9441.FE8CAB23_at_Unforgettable.com>...
>
> >Also, completely forget about OPEN/FETCH/CLOSE for explicit cursors.
> >Always use a cursor FOR loop. Once you get used to writing them and
> >handling all of the possible exceptions/errors you'll never want to go
> >back to the OPEN/FETCH/CLOSE syntax. Steve Feuerstein got this wrong in
> >his book and too many people follow his advice without thinking through
> >all of the consequences (he claims that there are no adverse
> >consequences and tries to lead the reader to believe that there are
> >inherent problems with the cursor FOR loop and trusts that the reader
> >won't know better).
>
> Not in the second edition of his "Oracle PL/SQL Programming" book
> O'Reilley, ISBN 1-56592-335-9) he doesn't. On page 33 he says:
>
> "The cursor FOR loop is one of my favourite PL/SQL constructs. It leverages
> fully the tight and effective integration of the Ada-like programming
> language with the power of the SQL database language. It reduces the volume
> of the code you need to write to fetch data from a cursor. It greatly
> lessens the chance of introducing errors in your programming - and loops
> are one of the more error-prone parts of a program. Does this loop sound
> too good to be true? Well, it isn't - it's all true."
>
> What book of Steven's were you reading?

In the original book (copyright 1995) on page 213 the autor goes into a discussion about "When To Use The Cursor FOR Loop". It is in that section he gets it wrong because he makes the assumption that it is wrong to exit from a cursor for loop before fetching all rows in its range. He apparently didn't think this through very well or else he has never worked in a situation where this might be a normal and frequent occurring. Received on Tue May 30 2000 - 00:00:00 CDT

Original text of this message

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