Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Opening multiple cursors in a loop in Oracle
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 BortelReceived on Mon Apr 18 2005 - 12:51:55 CDT