Home » SQL & PL/SQL » SQL & PL/SQL » How to close cursor
How to close cursor [message #265832] Fri, 07 September 2007 09:21 Go to next message
vasudevan
Messages: 119
Registered: February 2006
Location: TRICHY
Senior Member


Dear Techs,

please help me to close the cursor for following sample procedure.

declared variables in package;

This below procedure available in package body

PROCEDURE PROC_testnet_GETESB
(SBCursor IN OUT PACK_UTILITY.Type_Cursor,
nSchedid IN NUMBER
)
IS
BEGIN

OPEN SBCursor FOR
select SB.*,rownum from
(SELECT col1,colu2 from table ) SB;
End;

-Thanx in advance.
Re: How to close cursor [message #265835 is a reply to message #265832] Fri, 07 September 2007 09:29 Go to previous messageGo to next message
muzahid
Messages: 281
Registered: September 2004
Location: Dhaka, Bangladesh
Senior Member
simply

close SBCursor;
Re: How to close cursor [message #265838 is a reply to message #265835] Fri, 07 September 2007 09:39 Go to previous messageGo to next message
vasudevan
Messages: 119
Registered: February 2006
Location: TRICHY
Senior Member


Thank you sir

But if we used eg: close sbcursor;

output: no rows selected

If we comment eg: -- close sbcursor;

then it show output: 250 rows


- please help me to overcome this problem.


Re: How to close cursor [message #265841 is a reply to message #265832] Fri, 07 September 2007 10:09 Go to previous messageGo to next message
muzahid
Messages: 281
Registered: September 2004
Location: Dhaka, Bangladesh
Senior Member
Quote:

OPEN SBCursor FOR
select SB.*,rownum from
(SELECT col1,colu2 from table ) SB;
End;



When you use for loop you need not open cursor. Follow the following code
begin
for sb_cursor in SBCursor loop
select SB.*,rownum from
(SELECT col1,colu2 from table ) SB;
end loop;
end;
Re: How to close cursor [message #265849 is a reply to message #265838] Fri, 07 September 2007 10:41 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
output: no rows selected

The procedure you posted does not output any message, how can you get that?

Regards
Michel
Re: How to close cursor [message #265856 is a reply to message #265841] Fri, 07 September 2007 11:49 Go to previous messageGo to next message
vasudevan
Messages: 119
Registered: February 2006
Location: TRICHY
Senior Member


Thank you so much muzahidul islam it works.
Re: How to close cursor [message #265857 is a reply to message #265849] Fri, 07 September 2007 11:51 Go to previous messageGo to next message
vasudevan
Messages: 119
Registered: February 2006
Location: TRICHY
Senior Member


Thanx for reply michel

Actually we have tested datas in application side it shows no datas thats why i gave no row selected .
Re: How to close cursor [message #265896 is a reply to message #265841] Fri, 07 September 2007 14:22 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
muzahidul islam wrote on Fri, 07 September 2007 17:09

When you use for loop you need not open cursor. Follow the following code
begin
for sb_cursor in SBCursor loop
select SB.*,rownum from
(SELECT col1,colu2 from table ) SB;
end loop;
end;


This does not make sense. It would not even compile

[Updated on: Fri, 07 September 2007 14:22]

Report message to a moderator

Previous Topic: Can I create user defined TYPE from another schema?
Next Topic: get job_id in running job (dbms_job)
Goto Forum:
  


Current Time: Sat Dec 10 04:51:29 CST 2016

Total time taken to generate the page: 0.08724 seconds