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 commit in db2?
What are the bind parameters ibm db2?
If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?
What is the latest version of ibm db2?
Mention data types used in db2 ?
What does db2 mean?
What is cursor with hold option in db2?
What is dbrm? What it contains? When it will be created?
What kind of database is db2?
How do I add a column in db2?
Where do you specify them?
What do you mean by storage group (stogroup)?
What are the various isolation levels possible?
What is declare cursor?
How is the value function used?