how to fetch multiple records without using cursor
Answer Posted / m4io
it is not possible in db2 v8 : you still need a cursor.
However : you can fetch 100 rows in one fetch.
01 host-variables.
05 HV-col1-ARRAY PIC s9(04) COMP OCCURS 100 TIMES.
05 HV-col2-ARRAY PIC x(40) OCCURS 100 TIMES.
05 HV-vcol3-ARRAY OCCURS 100 TIMES.
49 HV-vcol3-len-ARRAY PIC s9(04) COMP.
49 HV-vcol3-txt-ARRAY PIC x(40).
05 HV-IND2-ARRAY PIC s9(04) COMP OCCURS 100 TIMES.
I
DECLARE csr1 CURSOR WITH ROWSET POSITIONING for select
col1, col2, vcol3 from ...
open cursor
FETCH NEXT ROWSET FROM csr1 FOR 100 ROWS
INTO :HV-col1-ARRAY,
:HV-col2-ARRAY:HV-IND2-Array,
:HV-vcol3-ARRAY
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
what is the sqlcode -501
How to take backup of table in db2?
What does reorg do in db2?
What is dbrm? What it contains?
My sql statement select avg(salary) from emp yields inaccurate results. Why?
What is the maximum number of columns in a db2 table?
What is the maximum size of a char data type in db2?
When reorg is used?
What is the syntax for FETCH in DB2 ?
How can we read records for specific member in CL? AND rpg?
What is dclgen (declaration generator)?
Mention the different locking levels that are available in db2.
Which component is used to execute the sql statements?
How to find the number of rows in a db2 table?
What is the difference between "db2ilist" and "db2 get instance" commands in DB2 Database Server?