- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the usage of host variables in case of multi row fetch?
The host variable needs to be declared as an array for the multi-row fetch. Also, we need to define another variable in the working storage section with the configuration S9(4) COMP, which will store the value of the number of rows to be fetched in a single fetch call.We can give any name to this variable, here we have used MAX-ROW. Below is an example of declaring a host variable array and MAX-ROW.
01 ORDER-ID PIC X(25) OCCURS 25 TIMES. 01 MAX-ROW PIC S9(4) COMP VALUE 25.
We will fetch the cursor like below.
EXEC SQL FETCH NEXT ROWSET FROM ORDER_CUR FOR :MAX-ROW ROWS INTO :ORDER-ID END-EXEC
Advertisements