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


Please Help Members By Posting Answers For Below Questions

What is the result of open cursor statement?

638


On which levels locks can be applied?

660


What is the maximum No of rows per page?

628


How many databases can be created inside an instance in db2 ?

602


How do I delete a table in database?

599






What is the difference between spufi and qmf?

639


Is it possible using max on a char column?

609


What is dclgen (declaration generator)?

603


can any one provide me the link for the db2 v7 & db2 v8 manual for Z/os? i need to know about the syntax of REORG in both versions & need to know the difference as well

1806


Define data page.

634


How do you find the maximum value in a column in db2?

650


If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?

706


What is reorg and runstats in db2?

696


What is buffer pool and list some of them?

630


Mention the location where the output received from explain statement is stored.

630