how to fetch multiple records without using cursor

Answer Posted / mahyn

However if we want to fetch and process multiple rows
without using cursor, we can do with the below psuedo code.

assume that seq_num is unique.
h-seq initilized with spaces.

perform until sqlcode = +100 or h-seq >= 500
exec sql
select seq_num into :seq-num from tablename
where seq_num > :h-seq
order by Seq_num with ur;
fetch first 1 row only
end-exec
operations
move seq-num to h-seq
end-perform

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need reorg in db2?

540


Name the lockable units in DB2?

641


What is dbrm?

620


I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.

1629


Which components manage deadlocks in db2?

585






What is dbrm in db2 database?

562


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?

6745


What is nvl in db2?

598


What is explain plan in db2?

561


What is deadlock in db2?

558


How do you select a row using indexes in db2?

616


What is concurrency?

682


What is database manager in db2?

525


What is runstats utility in db2?

544


Give a brief description of db2 isolation levels?

579