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

Re: PL/SQL Question

From: Richard J Woodland <richwoodland_at_interfacefamily.com>
Date: Fri, 05 Nov 1999 16:20:26 -0500
Message-ID: <38234A19.2D3DAF7E@interfacefamily.com>


The FOR loop both opens and closes the cursor. So, you do not need the CLOSE statement following the END LOOP. You are closing an already closed cursor, and that is causing the exception.

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 - 15:20:26 CST

Original text of this message

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