472,958 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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 6646
On Jun 28, 12:19 am, Dima Kuchin <kuc...@gmail.comwrote:
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
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...
5
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...
5
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...
6
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...
10
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)...
5
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...
3
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...
1
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...
6
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.