Home » SQL & PL/SQL » SQL & PL/SQL » last value/count before fetch from refcursor (oracle 9.2.0.3)
last value/count before fetch from refcursor [message #405357] Wed, 27 May 2009 07:30 Go to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
can we get the count or last row of fetch statement ( for resultset refcursor RC1)before using loop and executing for each loop?
Re: last value/count before fetch from refcursor [message #405361 is a reply to message #405357] Wed, 27 May 2009 07:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No.

Regards
Michel
Re: last value/count before fetch from refcursor [message #405364 is a reply to message #405357] Wed, 27 May 2009 07:37 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
No.
Re: last value/count before fetch from refcursor [message #405381 is a reply to message #405357] Wed, 27 May 2009 08:35 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
If you don't trust the answer I gave you, just say so.
Re: last value/count before fetch from refcursor [message #405386 is a reply to message #405381] Wed, 27 May 2009 08:45 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Frank wrote on Wed, 27 May 2009 15:35
If you don't trust the answer I gave you, just say so.

It was a too sophisticated answer; "no" is the correct level. Smile

Regards
Michel

Re: last value/count before fetch from refcursor [message #405393 is a reply to message #405386] Wed, 27 May 2009 09:32 Go to previous messageGo to next message
Olivia
Messages: 519
Registered: June 2008
Senior Member
This can be used by modifying the resulset I think.

select column1, count(*) over () TCount,column3
from some_table

[Updated on: Wed, 27 May 2009 09:53]

Report message to a moderator

Re: last value/count before fetch from refcursor [message #405407 is a reply to message #405393] Wed, 27 May 2009 10:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Olivia wrote on Wed, 27 May 2009 16:32
This can be used by modifying the resulset I think.

select column1, count(*) over () TCount,column3
from some_table

Pff! You pretty well read the link and answer posted by Frank...

Regards
Michel

Re: last value/count before fetch from refcursor [message #405410 is a reply to message #405393] Wed, 27 May 2009 10:14 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Olivia wrote on Wed, 27 May 2009 16:32
This can be used by modifying the resulset I think.

select column1, count(*) over () TCount,column3
from some_table




Wow.. Now THAT's what I call a smart solution.
Too bad I didn't think of that.

Oh wait..
Re: last value/count before fetch from refcursor [message #405412 is a reply to message #405407] Wed, 27 May 2009 10:15 Go to previous messageGo to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
Yes reading the link provided by Frank I did tried.
But how it gonna be used before fetch?

[Updated on: Wed, 27 May 2009 10:18]

Report message to a moderator

Re: last value/count before fetch from refcursor [message #405425 is a reply to message #405412] Wed, 27 May 2009 11:28 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
It can't be - that's what we're trying to say.

Before you have fetched all the rows from a cursor, there is no way of knowing how many rows it will bring back.
Previous Topic: Query to find all the column references..
Next Topic: "LIKE" query question
Goto Forum:
  


Current Time: Tue Dec 06 00:05:06 CST 2016

Total time taken to generate the page: 0.14364 seconds