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 are iseries servers?
How can deadlocks be resolved?
What is syscat in db2?
Suppose pgm A calling Pgm B .Pgm B has some Db2 program. at the time of compilation should plan and package will be created for both A and B or only B? What is the concept?
How to check last update on table in db2?
What kind of database is db2?
I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.
When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?
What does db2 stand for?
What is temporal table in db2?
What is access path in db2?
What happens in bind step in a db2 program?
How can we read records for specific member in CL? AND rpg?
What is dbrm library?
Define buffer pool.