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
What is a storage group (stogroup)?
What is the use of reorg in db2?
How to access db2 tables in mainframe?
Define check constraint.
Define db2.
What is bind in db2?
How do you pull up a query which was previously saved in qmf?
in my project..TEST is db2 8.1 version In PROD it is 7.1 if i do REORG in TEST.. can I use the same REORG jcl with out modification in PROD region (this is DB2 8.1 )? if not, what modification i need to do in my REORG control card?
What are catalog tables in db2?
Mention the way of highlighting as well as putting a cursor to use in a cobol program.
What is the difference between oracle and db2?
Can you tell me how can you find out the # of rows updated after an update statement?
What is a bind in db2?
How can we read records for specific member in CL? AND rpg?
What is dclgen in db2?