---
title: "DB2: What is an Ambiguous Cursor"
description: "DB2 ambiguous cursor in SQL and examples and resolution."
url: https://srinimf.com/2013/08/10/db2-what-is-an-ambiguous-cursor/
date: 2013-08-10
modified: 2021-10-27
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2013/08/pexels-photo-6177596.jpeg?fit=1880%2C1253&ssl=1
categories: ["DB2"]
tags: ["DB2 Cursors", "DB2 Tips and Solutions"]
type: post
lang: en
---

# DB2: What is an Ambiguous Cursor

Here is the reason for the Ambiguous cursor and resolution for how to avoid it. It’s useful for interviews and projects as well.

## Ambiguous Cursor

- When DB2 does not know whether or not you will use the cursor for updating or deleting, it will prepare for a worst-case scenario (that you do perform an update). When DB2 is in doubt, the cursor is called ambiguous. And the access path chosen by the optimizer will not necessarily be the best for the function performed.
- How to avoid it? use *FOR UPDATE OF* clause along with *UPDATE WHERE CURRENT OF *statement. Further, your purpose is only retrieving data, then code *FOR FETCH ONLY* or *FOR READ ONLY* statements. 

Related articles

1. [DB2 basic commands](http://websphere4u.wordpress.com/2013/08/04/db2-basic-commands/)
2. [Ambiguous cursors examples![](https://i0.wp.com/img.zemanta.com/pixy.gif)](https://srinimf.com/2018/02/11/sql-ambiguous-column/)

Get new content delivered directly to your inbox.

Type your email…

Sign up

- [![How to Find Databricks Job Status, Owner, and Active Runs Fast](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/10/pexels-photo-30972899.jpeg?resize=867%2C1300&ssl=1)](https://srinimf.com/2026/10/17/databricks-find-job-status/) ## [How to Find Databricks Job Status, Owner, and Active Runs Fast](https://srinimf.com/2026/10/17/databricks-find-job-status/) Need to audit Databricks workflows? Step-by-step guide to tracking job creators, service principal run identities, and current execution status in Databricks.

### 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%2F2013%2F08%2F10%2Fdb2-what-is-an-ambiguous-cursor%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2013%2F08%2Fpexels-photo-6177596.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=DB2%3A%20What%20is%20an%20Ambiguous%20Cursor)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2013/08/10/db2-what-is-an-ambiguous-cursor/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2013/08/10/db2-what-is-an-ambiguous-cursor/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2013/08/10/db2-what-is-an-ambiguous-cursor/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2013/08/10/db2-what-is-an-ambiguous-cursor/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20DB2%3A%20What%20is%20an%20Ambiguous%20Cursor&body=https%3A%2F%2Fsrinimf.com%2F2013%2F08%2F10%2Fdb2-what-is-an-ambiguous-cursor%2F&share=email)
-

### Like this:

Like Loading…