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 catalog database in db2?
What is host variable in db2 cobol?
What is the reason behind not using select * in embedded sql programs?
What does a deadlock mean in DB2?
What does db2 stand for?
How to check table size in db2 sap?
What is performance tuning db2?
What is dclgen (declaration generator)?
Comment whether dclgen is mandatorily used. If not, then what is the point of using it?
How do you concatenate the firstname and lastname from emp table to give a complete name?
What happens in bind step in a db2 program?
What do you mean by rollback?
What is the meaning concurrency in the db2 database?
What are the uses of db2 optimizer?
What is package in cobol db2?