This content has been marked as final. Show 12 replies
you dont have to close refcursor and instead of writing cs you have to write pkgRes.resType. like
open cs for
select * from res where res_id = p_id;
OPEN pkgRes.resType FORCode is not tested
WHERE res_id = p_id;
hi, something like:
IF company_cur%ISOPEN THEN
Thx for the quick posts guys,
but if I write
OPEN pkgRes.resType FOR
SELECT * FROM res WHERE res_id = p_id;
what will be my out parameter between ( ... )
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.
the programming language is visual studio 2005 - ASP.NET 2.0
I am also facing the same problem of open cursors. All my stored procedures return a refcursor. I am calling them from a j2ee web application using iBatis frame work.
How do I close these cursors from my application.
As saild earlier, Use the close method of the recordset object.
It appears that iBatis framework is closing it. But let me just confirm and get back to you.
This may give u some pointer.
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.
Check out this link