---
title: "Top Rowset Positioning Examples for INSERT, UPDATE and DELETE"
description: "Rowset positioning top examples on how to use it and work with multiple rows in DB2."
url: https://srinimf.com/2016/01/25/db2-in-cursor-with-multi-record-fetching/
date: 2016-01-25
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2016/01/insert-update-delete-multi-rows.jpg?fit=1200%2C900&ssl=1
categories: ["DB2"]
tags: ["sql row set positioned cursor"]
type: post
lang: en
---

# Top Rowset Positioning Examples for INSERT, UPDATE and DELETE

## INSERT, UPDATE and DELETE [DB2 Rowset](https://srinimf.com/2010/10/16/db2-we-can-fetch-multi-rows-with-cursor/) Positioning

Example SQL queries [to use](https://srinimf.com/2022/02/14/merge-sql-query-these-are-useful-points-to-know/) rowset positioning to carry INSERT, UPDATE and DELETE of Multi rows

> 5 different best examples of Rowset positioning usage in DB2. These examples include to DELETE, UPDATE and SELECT multiple rows.[Tweet](http://twitter.com/share?&text=5%20different%20best%20examples%20of%20Rowset%20positioning%20usage%20in%20DB2.%20These%20examples%20include%20to%20DELETE%2C%20UPDATE%20and%20SELECT%20multiple%20rows.&url=https://srinimf.com/2016/01/25/db2-in-cursor-with-multi-record-fetching/)

### **SELECT – FETCH FIRST 20 ROWS WITH ROWSET POSITIONING**

```
FETCH NEXT ROWSET 
FROM C1 FOR 20 ROWS   INTO :HVA-EMPNO, :HVA-LASTNAME, :HVA-SALARY :INDA-SALARY  
END-EXEC.
```

### **UPDATE – ROWS FROM ROWSET POSITIONING**

The below query update salary to 5000 in all the rows of rowset result table.

```
EXEC SQL  
UPDATE DSN8B10.EMP SET SALARY = 50000  
WHERE CURRENT OF C1  END-EXEC.
```

### **DELETE – ROWS FROM ROWSET POSITIONING**

Below query deletes all the rows of rowset positioning result table.

```
EXEC SQL   
DELETE FROM DSN8B10.EMP   
WHERE CURRENT OF C1  
END-EXEC.
```

**Recent Posts**

- [How to Find Databricks Job Status, Owner, and Active Runs Fast](https://srinimf.com/2026/10/17/databricks-find-job-status/)
- [30 SQL Practice Queries with Solutions — Run Them Live](https://srinimf.com/2026/10/01/30-sql-practice-queries-with-solutions-run-them-live/)
- [Supercharge Your Database Skills: Try Our New Interactive SQL Plugin!](https://srinimf.com/2026/09/30/supercharge-your-database-skills-try-our-new-interactive-sql-plugin/)

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2016%2F01%2F25%2Fdb2-in-cursor-with-multi-record-fetching%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2016%2F01%2Finsert-update-delete-multi-rows.jpg%3Ffit%3D1200%252C900%26ssl%3D1&description=Top%20Rowset%20Positioning%20Examples%20for%20INSERT%2C%20UPDATE%20and%20DELETE)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2016/01/25/db2-in-cursor-with-multi-record-fetching/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2016/01/25/db2-in-cursor-with-multi-record-fetching/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2016/01/25/db2-in-cursor-with-multi-record-fetching/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2016/01/25/db2-in-cursor-with-multi-record-fetching/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Top%20Rowset%20Positioning%20Examples%20for%20INSERT%2C%20UPDATE%20and%20DELETE&body=https%3A%2F%2Fsrinimf.com%2F2016%2F01%2F25%2Fdb2-in-cursor-with-multi-record-fetching%2F&share=email)
-

### Like this:

Like Loading…
