This content has been marked as final. Show 12 replies
Your original code as posted is fine. It is up to the caller to close the cursor when they are finished with it. So, the caller should be something like:
FETCH l_cur INTO l_rec
EXIT WHEN l_cur%NOTFOUND;
<< Do whatever >>
No. The original source is correct. And you are correct that you cannot close the cursor within the stored procedure.
The calling code is responsible for closing the cursor.
If the calling language is PL/SQL you will have declared another variable of type REF CURSOR to pass as the OUT parameter. In which case you will just close that variable.
Typically in other calling languages the REF CURSOR is mapped to a result set object with an appropriate method to close the cursor.
Hello Guys, My name is Ahmad from Amman Jordan.
Guys i need help pls
i am making two procedures and calling one by the other
1) PROCEDURE a_call_cur2(P_CUR OUT TYPES.REF_CURSOR) aS
open p_cur for select * from agents;
2)PROCEDURE a_test1(PROC_Name varchar2,P_CUR OUT TYPES.REF_CURSOR) as
execute immediate ('begin '|| names||'; end;');
i want to call a cursor from A_Call_CUR2 proceduer by A_Test1 procedure, but its not working..
How can i call a cursor as output parameters by A_Test1 proc from another proc like A_Call_Cur2 ???+
Note: Proc_Name = A_Call_Cur2
Pls i need it.