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

What is the physical storage length of timestamp data type?

646


What does reorg do in db2?

578


What is bind plan?

612


Explain dclgen.

724


What is reorg and runstats in db2?

696






What is db2 catalog database?

582


What is the difference between bind and rebind in db2?

858


What is a storage group (stogroup)?

778


What is a system catalog table in db2?

589


Are views updateable?

646


What is db2? Explain.

606


What is role in db2?

620


What is db2 optimizer?

771


List out the buffer pools in db2

632


What is the result of open cursor statement?

638