Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How will you extract multiple rows from a DB2 table in a single FETCH call?
We can extract multiple rows from a DB2 table in a single FETCH call using a concept of multi row fetch.
In a multi row fetch, we have to declare the cursor with the clause “WITH ROWSET POSITIONING”. The host variable in this case should be declared as an array.
Therefore, in a single fetch statement the host variable array will be populated with the multiple row data. We can traverse in the host variable array in order to access this row data.
For example, we can declare a multi fetch cursor like below−
EXEC SQL DECLARE ORDER_CUR WITH ROWSET POSITIONING FOR SELECT ORDER_ID FROM ORDERS WHERE ORDER_DATE = ‘2020-07-28’ END-SQL
Advertisements
