Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 catalog database in db2?

1110


What is host variable in db2 cobol?

1036


What is the reason behind not using select * in embedded sql programs?

1059


What does a deadlock mean in DB2?

1109


What does db2 stand for?

965


How to check table size in db2 sap?

984


What is performance tuning db2?

1018


What is dclgen (declaration generator)?

1016


Comment whether dclgen is mandatorily used. If not, then what is the point of using it?

1019


How do you concatenate the firstname and lastname from emp table to give a complete name?

1027


What happens in bind step in a db2 program?

928


What do you mean by rollback?

944


What is the meaning concurrency in the db2 database?

1068


What are the uses of db2 optimizer?

1238


What is package in cobol db2?

1086