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

How would you find out the total number of rows in a db2 table?

576


Hi Everyone... Under the Logical files, when am working on multiple rec format logical file, I have joined two pf's using the multiple record format logical file concept, but when i run queried the LF only the first mentioned pf records are reflecting and I am not able to see any of the field records specified under the second pf. Kindly let me know whats the reason behind this. Below is the str of LF., R rec PFILE(LOGICAA) CUSTNO CUSTNAME BILL K CUSTNO R rec1 PFILE(LOGICAA1) CUSTNO ADD K CUSTNO .....

1897


In an sql table that is embedded, what is the procedure to retrieve rows that are part of a db2 table?

642


What is data manager?

607


What are the contents of a dclmgen?

628






What is commit in db2?

595


How to compare data between two tables in db2?

658


What is db2 look?

576


What is collection in db2 bind?

575


Define data page.

630


How can we read records for specific member in CL? AND rpg?

233


What is cobol db2?

568


How to find the number of rows in a db2 table?

644


File not opened because library is *PROD and debug is UPDPROD(*NO). ? what may be the reason? how to solve it..?

2375


How to resolve deadlock issue

17971