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: PL/SQL Question

Re: PL/SQL Question

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Fri, 05 Nov 1999 22:15:36 GMT
Message-ID: <387e56df.217382928@netnews.worldnet.att.net>

Don't close the cursor after the FOR loop. When you use a cursor in a cursor FOR loop, the opening and closing are implicit.

Jonathan



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are

On Fri, 05 Nov 1999 20:17:59 GMT, amerar_at_ci.chi.il.us wrote:

>
>
>Hello,
>
>This code is giving me an invalid cursor. What is wrong with it? It is
>going down on the CLOSE statement.......
>
>
>CURSOR revanal_strts_cursor IS
> select * from tx_street_sanitation;
>
>BEGIN
> UTL_FILE_HANDLE1 := UTL_FILE.FOPEN(UTL_PATH,UTL_STRTS_FILENAME,'w');
>
> FOR v_revanal_strts_curs_rec IN revanal_strts_cursor
> LOOP
> v_strts_rec_read := v_strts_rec_read + 1;
> v_strts_batch_amt := v_strts_batch_amt +
> TO_NUMBER(NVL(v_revanal_strts_curs_rec.amt_cash,0)) +
> TO_NUMBER(NVL(v_revanal_strts_curs_rec.amt_check,0)) +
> TO_NUMBER(NVL(v_revanal_strts_curs_rec.amt_credit,0));
> END LOOP;
> UTL_FILE.PUT_LINE(UTL_FILE_HANDLE1,
> 'BH' || '99 ' ||
> TO_CHAR(sysdate,'DD') ||
> LPAD(SUBSTR(TO_CHAR(v_strts_rec_read),7,4),4,'0') ||
> LPAD(TO_CHAR(v_strts_batch_amt),10,'0') ||
> TO_CHAR(sysdate,'MMDDYY') ||
> LPAD(' ',53,' '));
>
> CLOSE revanal_strts_cursor;
> OPEN revanal_strts_cursor;
>
> FOR v_revanal_strts_curs_rec IN revanal_strts_cursor
> LOOP
> BEGIN
> .
> .
> .
> .
>
>Anyone see anything?
>
>Thanks,
>
>Arthur
>amerar_at_ci.chi.il.is
>
>ps. Please cc copy to e-mail
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Fri Nov 05 1999 - 16:15:36 CST

Original text of this message

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