Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using cursor as OUT parameter in Stored Procedure

Author  Topic 

morphnike
Starting Member

1 Post

Posted - 2006-02-01 : 07:14:43
Hi guys,

I have a serious problem.

I need to use my cursor as an out parameter, but the problem is, HOW CAN I CLOSE THE CURSOR??????

If I dont close the cursor, my server is getting really slow because of the open cursors, cause I have more than 100 stored procedures, which have a cursor as an out-parameter.

Here's one of my stored procedures :

create or replace PACKAGE pkgRes
IS
TYPE resType IS REF CURSOR RETURN res%ROWTYPE;
END pkgRes;

create or replace procedure res_sel_val
(p_id in number,cs out pkgRes.resType)
as
BEGIN
open cs for
select * from res where res_id = p_id;
--close cs;
EXCEPTION
when others then
raise_application_error(-20970, 'record kan niet geselecteerd worden');
END res_sel_val;


How can I close my cursor?
If I write the "close cursor" (which is in red at the code above), it returns an empty cursor, which is not my intention.

Please help me with this

Thanks in advance

Morph 'n Nike

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-01 : 08:06:56
This looks like PL/SQL for Oracle ?

This is a MS SQL Server forum. Try post it to http://forums.oracle.com/
or http://www.dbforums.com./

----------------------------------
'KH'


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-01 : 08:35:56
or www.OraFaq.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -