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: Opening multiple cursors in a loop in Oracle

Re: Opening multiple cursors in a loop in Oracle

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Mon, 18 Apr 2005 19:51:55 +0200
Message-ID: <d40rt0$es3$1@news1.zwoll1.ov.home.nl>


Mr Not So Know It All wrote:
> Im a newbie. Please help if you can.
>
> basically, im getting this error from SQL Plus
>
> ERROR at line 1:
> ORA-06511: PL/SQL: cursor already open
> ORA-06512: at "SAFETYUSER.SELECT_RS", line 62
> ORA-06512: at "SAFETYUSER.SELECT_RS", line 77
> ORA-06512: at line 9

[snip!]
>
> BEGIN
>
> FOR sel_Dev_lp IN cur_obsID
> LOOP
> open cur_ID_Obs(sel_Dev_lp.obsID); -- pass obsID to cur_ID_Obs
> fetch cur_ID_Obs into obsRow;
> close cur_ID_Obs;
> open cur0022; <---------------------------------------------line 77
> END LOOP;
>
> END;
So you loop over an "open cursor" statement. So the error is "the cursor is already open"

What do you not understand?
No, you cannot open the same cursor twice in a loop. That's what the error says.

-- 
Regards,
Frank van Bortel
Received on Mon Apr 18 2005 - 12:51:55 CDT

Original text of this message

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