Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: LOOP question

Re: LOOP question

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: Wed, 15 Sep 1999 20:54:32 GMT
Message-ID: <cITD3.234$tS.13131@nntp.csufresno.edu>

  1. Exit when... pretty much ALWAYS follows the fetch on the very next line. (This is your main problem)
  2. Indent your code to show the logicial flow and hierarchy. See below. Non-indented code is really tough to debug. Believe me--people who don't follow this convention don't last long as programmers. Steve Cosner

In article <19990915161014.02295.00000716_at_ng-fm1.aol.com>, Iancrozier <iancrozier_at_aol.com> wrote:
>I have code something like:
>DECLARE
> v_column number;
> CURSOR a IS SELECT column FROM table;
>BEGIN
> OPEN a;
> LOOP
> FETCH a INTO v_column;
> mesg := (RPAD(vcolumn,12));
> UTL_FILE.PUTF(file_name,'%s\n',mesg);
> UTL_FILE.PUT_LINE(file_name,' . ');
> UTL_FILE.FFLUSH(file_name);
> EXIT WHEN A%NOTFOUND;
> END LOOP;
>END;
>-- End of code
>When I look into file_name, the last row is always in there TWICE!
>What am I doing wrong? TIA
>Ian Crozier
Received on Wed Sep 15 1999 - 15:54:32 CDT

Original text of this message

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