Home » SQL & PL/SQL » SQL & PL/SQL » last value in cursor active set
last value in cursor active set [message #192522] Tue, 12 September 2006 13:15 Go to next message
basirana
Messages: 25
Registered: July 2006
Junior Member
Hi

I am writing a program to fetch values from cursor.
I need to put condition to find last value in the active set.

I have tried using %found and %notfound parameters.

Is there anyway I can find last fetch in the for loop.

Thanks
Re: last value in cursor active set [message #192616 is a reply to message #192522] Wed, 13 September 2006 00:32 Go to previous messageGo to next message
sandeepk7
Messages: 137
Registered: September 2006
Senior Member

Try this

Declare
Cursor c_data is select * from tbl1;
v_data c_data%rowtype;
Begin
Open C_data;
Loop
Fetch C_data into v_data;
if c_data%notfound and c_data%rowcount>1 then
/*c_data%rowcount>1 is condition to check if cursor is having any value Or you can remove it if dont want to put this check.*/

--Your Condition to for Last Value Condition

End Loop;
Close C_data;
End;

Sandy

[Updated on: Wed, 13 September 2006 00:36]

Report message to a moderator

Re: last value in cursor active set [message #192631 is a reply to message #192616] Wed, 13 September 2006 01:43 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
I would reverse the sort of my data set and do something with the first record. A lot easier to program Wink

MHE
Previous Topic: To get some 10 out of n for each attribute in the same table.
Next Topic: constant name
Goto Forum:
  


Current Time: Fri Dec 06 01:27:31 CST 2024