Hi, I'm having a heck of a time getting this procedure to work.

I've simplified the procedure down to basically just opening a cursor and closing it, but I'm still getting an error that the cursor is still open.

I can install the procedure, but when I call it I get the error about the cursor still being open.(ORA-06511)

Here's my test block:

BEGIN
cur_test_procedure;
END;

And the procedure that's giving me the problem:

CREATE OR REPLACE PROCEDURE cur_test_procedure
IS 
CURSOR row_cursor IS
SELECT t1.col1, t1.col2, t1.col3
FROM test_table1 t1, test_table2 t2
WHERE t1.col2 = t2.col2;


BEGIN

OPEN row_cursor;
for cur_row in row_cursor
LOOP
DBMS_OUTPUT.PUT_LINE( 'hello world' );
END LOOP;
CLOSE row_cursor;
END;
/

I'm sure its a simple fix, but have been struggling with it for hours. I've tried many different ways of opening/closing the cursor and looping, but nothing is working.

Thanks for any ideas.

It works when I took out the open/close cursor statements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.