- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Fetch random rows from a table with MySQL
- How to fetch only a single result from a table in Java-MySQL?
- How will you find out all the indexes which are built in a particular DB2 table?
- How will you detect the condition of the end of cursor rows in a COBOL-DB2 program?
- How can we delete multiple rows from a MySQL table?
- How to insert multiple rows in a table using a single INSERT command in program?
- How will you create a new TRIGGER on the ORDERS DB2 table? Give the syntax of TRIGGER
- Update multiple rows in a single MongoDB query?
- Insert multiple rows in a single MySQL query
- What is STORED PROCEDURE in a DB2? How will you create a new stored procedure?
- How can you revert all the DB2 table changes done in a COBOL-DB2 program?
- How will you add a constraint on above DB2 table TAB1 for ages between 3 to 16 years?
- How to obtain multiple rows in a single MySQL query?
- How to get multiple rows in a single MySQL query?
- Fetch specific rows from a MySQL table with duplicate column values (names)?