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: Aamir Siddiqi <aamir_mas_at_hotmail.com>
Date: Sun, 7 Nov 1999 13:23:15 +0500
Message-ID: <3825c475@news.cyber.net.pk>


Dear Amer,

When cursors are used in a for loop, you dont have to close it explicitly, Oracle itself closes the cursor.

So just remove the close cursor statement, it will work perfectly. Also there is no need of opening the cursor again. If you want to use it again in a cursor-for loop.

Regards,

Aamir Siddiqi

<amerar_at_ci.chi.il.us> wrote in message news:7vve1e$6p9$1_at_nnrp1.deja.com...
>
>
> 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 Sun Nov 07 1999 - 02:23:15 CST

Original text of this message

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