473,748 Members | 6,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When to use cursors?

Hello,

I was trying to find the information about when and where should I use
cursors in DB2, no luck. Maybe you can point me to some article that
describes just that (or tell me which page is it in DB2 SQL reference
book, if it's there)? Or maybe you can post a short answer here, if
there's no dedicated article?

Another question would be about scrollable cursors (just found out
about their existence) - what performance gains will I get by using
them over the technique I'm using right now:

<code>SELECT T.* FROM
(SELECT FOO.*, ROWNUM() as ROWNUM
FROM (some query) AS FOO
) AS T
WHERE T.ROWNUM RMIN AND T.ROWNUM < RMAX</code>

I'm using PHP via ibm_db2 PECL module, but also plan to use Python
soon (most probably via PyDB2). Considering to use stored procedures.

Jun 28 '07 #1
1 6695
On Jun 28, 12:19 am, Dima Kuchin <kuc...@gmail.c omwrote:
Hello,

I was trying to find the information about when and where should I use
cursors in DB2, no luck. Maybe you can point me to some article that
describes just that (or tell me which page is it in DB2 SQL reference
book, if it's there)? Or maybe you can post a short answer here, if
there's no dedicated article?

Another question would be about scrollable cursors (just found out
about their existence) - what performance gains will I get by using
them over the technique I'm using right now:

<code>SELECT T.* FROM
(SELECT FOO.*, ROWNUM() as ROWNUM
FROM (some query) AS FOO
) AS T
WHERE T.ROWNUM RMIN AND T.ROWNUM < RMAX</code>

I'm using PHP via ibm_db2 PECL module, but also plan to use Python
soon (most probably via PyDB2). Considering to use stored procedures.
Dima

I'd suggest you start with the following information in the DB2 9
Information Center:

When to use cursors (particularly scollable cursors):
http://publib.boulder.ibm.com/infoce...c/t0005656.htm

Cursors and SQL procedures:
http://publib.boulder.ibm.com/infoce...c/c0024361.htm

Cursors and CLI applications:
http://publib.boulder.ibm.com/infoce...c/c0007645.htm

Differences between scrollable vs. "forward-only" cursors:
http://publib.boulder.ibm.com/infoce...c/c0007649.htm

Cursors and performance considerations (specifically CS isolation
level):
http://publib.boulder.ibm.com/infoce...c/t0005656.htm

Hope this helps.

Jun 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
9023
by: Alban Hertroys | last post by:
Oh no! It's me and transactions again :) I'm not really sure whether this is a limitation of psycopg or postgresql. When I use multiple cursors in a transaction, the records inserted at the start of the transaction aren't visible to those later on in that transaction (using a different cursor). Attached is a simplified example (the except's are a bit blunt, I know) of what I'm trying to do. In reality, the different cursors are...
5
6190
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select from the cli is for all intents practicaly instantaneous. After much research I discovered that PHP by default uses a dynamic cursor type which can be quite a bit slower than a forward only cursor. BTW I have been searching forward only/read...
5
1488
by: Just Me | last post by:
I have a UserControl that contains a few controls on it. If when one of the buttons is clicked I want to, in the click event, set the cursor to Cursor = Cursors.WaitCursor I want the cursor to change everywhere on the UserControl. Do I have to loop over the UserControl's Control collection and set each control's cursor?
6
2511
by: a | last post by:
Hello, I am doing some multithreading in an MDI app, and I can't seem to get the cursor to stay as an Hourglass. I call: Cursor.Current = cursors.wait at the beginning of my routing, and set it back to cursors.default when the thread ends (using a callback)
10
17368
by: Just Me | last post by:
Does Me.Cursor.Current=Cursors.WaitCursor set the current property of Me.Cursor to Cursors.WaitCursor And Me.Cursor.Current=Cursors.Default set the Me.Current property to something (default) stored in Me.Cursor. Or is Cursors.Default some process wide cursor shape? What is a correct statement?
5
1385
by: Boni | last post by:
Dear all, 1.Is there a standard set of cursors in windows which can be used? If yes, where. I need a "hand"- cursor for drag-drop operation. 2. What is a best practice to place cursors? In app directory or in resource file? Thanks, Boni
3
2302
by: schwartzenberg | last post by:
Dear friends, I have just run into a strange DB2 problem. Something i'd some of you would answer, if only shortly. My basic question is: How do i ensure 'insensitive' (ie static) cursors that are only forward readable (in DB2 for mainframe)?? It seems that the cursors i'm working on suddenly have become (after
1
23903
by: mrcraze | last post by:
Hi Everyone! We are using a cursor for paging results in SQL server, mainly due to the performance gains achieved when working with large results sets. We have found this to be of great benefit when working with SQL Server 2000, but have run into major problems when using it on SQL Server 2005. The query goes like this:
6
1952
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to implement the following: If the user clicks on the border of a form, then I want to show a box around the form that represents the form's bounds. As the user moves the mouse only the box's bounds would change. When the user releases the mouse the form's bounds would be set to the bounds of the box. Note that this is very similar to how the Splitter control works. Does anybody know how to do this?
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.