Home » SQL & PL/SQL » SQL & PL/SQL » count in refcursor
count in refcursor [message #361025] Mon, 24 November 2008 21:19 Go to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
Hi,

Is there any way to find the number of rows returning from refcursor without actually opening or reexecuting the query.
?
i want to send the user the refcursor values and also number of rows iam sending.

Pls help!

Thanks
Re: count in refcursor [message #361030 is a reply to message #361025] Mon, 24 November 2008 22:11 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Why don't you calculate count of rows in your refcursor query.


Regards,
Rajat
Re: count in refcursor [message #361031 is a reply to message #361025] Mon, 24 November 2008 22:12 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

I dont think it ois possiblw without opening it . Anyway why can't youn use count(*) ?

Smile
Rajuvan.
Re: count in refcursor [message #361046 is a reply to message #361031] Mon, 24 November 2008 23:29 Go to previous messageGo to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
i have a refcursor
open ref_cusror for....

irrespective of what iam sending,i want to calculate hw many no of recs iam sending out.
let me know if you know any way to do it.

Thank you
Re: count in refcursor [message #361050 is a reply to message #361046] Mon, 24 November 2008 23:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
There is no way.
In addition, a ref cursor does not send anything, you fetch the rows from a ref cursor, how many you want.

The good question is "why do you want to know the number of rows in the result set?"

Regards
Michel
Re: count in refcursor [message #361052 is a reply to message #361046] Mon, 24 November 2008 23:38 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Quote:

i have a refcursor
open ref_cusror for....

irrespective of what iam sending,i want to calculate hw many no of recs iam sending out.
let me know if you know any way to do it.

Thank you


You cannot know in advance but you can include that one in your
ref cursor query.

We have already given you answer change your query for ref_cursor to include number of rows that query returns.

Regards,
Rajat
Re: count in refcursor [message #361054 is a reply to message #361052] Mon, 24 November 2008 23:43 Go to previous messageGo to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
There should be a way.you are already executing query to open the refcursor.so you should get how many records resulted out.

Re: count in refcursor [message #361058 is a reply to message #361025] Mon, 24 November 2008 23:47 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member


Quote:
There should be a way


No. Experts says . Try it out with google .

Smile
Rajuvan.
Re: count in refcursor [message #361085 is a reply to message #361054] Tue, 25 November 2008 00:33 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
There should be a way.you are already executing query to open the refcursor.

No there is NOT.
You seem to not understand what "executing query" means.
Read Database Concepts
Chapter 24 SQL, PL/SQL, and Java
Section Overview of SQL
Subsection SQL Processing

Regards
Michel


Previous Topic: Calculating a row value from the previous row value in a query statement
Next Topic: Exception messages
Goto Forum:
  


Current Time: Sun Dec 04 12:37:32 CST 2016

Total time taken to generate the page: 0.07706 seconds