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: PLS/SQL: OK to use EXIT in a cursor FOR LOOP ??

Re: PLS/SQL: OK to use EXIT in a cursor FOR LOOP ??

From: Walter Dnes <waltdnes_at_interlog.com>
Date: Fri, 25 Jun 1999 23:29:12 GMT
Message-ID: <3774031b.839673@news.interlog.com>


On Wed, 23 Jun 1999 11:59:30 GMT, tkyte_at_us.oracle.com (Thomas Kyte) wrote:

>for x in ( select * from a10million_row_table for update ) loop
> ...
>end loop;
>
>will perform IDENTICALLY to
>
>declare
> cursor c1 is select * from a10million_row_table for update;
>begin
> open c1;
> loop
> fetch c1 into rec;
> exit when c1%notfound;
> ...
> end loop;
> close c1;
>end;

  True, but there are occasions where I may not want to close the cursor when exiting the loop. Case in point, a project my boss and I are working on. Analyze 40 or 50 years of weather data at each of several stations. For external reasons, a Visual Basic frontend was required. As Martha Stewart would say, dragging down 40 or 50 years of *HOURLY* data for several weather stations, over a WAN, "is not a good thing". Since we only needed a monthly summary, I created a package and loaded it on our server. VB would make one call per month of data to the package, and get a small summary for the month.   Each call would have to pick up where the previous call left off, i.e. at the beginning of the next month. The alternative to leaving the cursor open for the next call would be to open a cursor for one month of data on each pass, but that would be painful.

--
Walter Dnes <waltdnes_at_interlog.com> procmail spamfilter http://www.interlog.com/~waltdnes/spamdunk/spamdunk.htm Why a fiscal conservative opposes Toronto 2008 OWE-lympics http://www.interlog.com/~waltdnes/owe-lympics/owe-lympics.htm Received on Fri Jun 25 1999 - 18:29:12 CDT

Original text of this message

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