Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I have a table which has thousand of records i want to
fetch only record num 100 to record num 200. Write a query
that satisfies this criteria.(Cant use any keys)
Anyone please reply ASAP!

Answer Posted / sudheer d

YA THE ANSWER IS BY USING CURSORS ONLY
declare
cursor USER_Cursor
is select *
from <table_name>;

y <TABLE_NAME>%ROWTYPE; --ITS A DATA TYPE INCLUDES
WHOLE ROW 4M A TABLE IN TO X
COUNT1 number(2);

begin
COUNT1:=1;
open USER_Cursor;

while USER_Cursor%FOUND AND COUNT1 <>101
loop
fetch USER_Cursor into y;-- JUST FETCH DONT DISPLY -
--TILL 101ST RECORD
COUNT1:=COUNT1+1;
end loop;

--NOW DISPLAY FROM 101 RECORD TO 200 RECORD
while USER_Cursor%FOUND AND COUNT1 <>201
loop
fetch USER_Cursor into y;
dbms_output.put_line(y);
COUNT1:=COUNT1+1;
end loop;

close USER_Cursor;
end;

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I copy a table in db2?

988


What is a db2 table?

988


What is package in db2 mainframe?

966


What is rebind in db2?

1035


What is the role of union all and union

1103


What is deadlock in db2?

1050


Which component is used to execute the sql statements?

1082


What is the use of db2?

1034


How do I add a column in db2?

1029


Outputs of explain are with matchcols = 0. What does this signify?

1041


before altering a table is it necessary to lock ? if lock what is it ? how to do ? ifi want to lock a table what is that command ?

2163


What is multi row fetch in db2?

1022


Comment whether the cursor is closed during commit or not.

1080


What is bind plan?

1036


How can you count the number of rows from a table tab?

1075