View previous topic :: View next topic |
Author |
Message |
Martin Beginner
![](images/avatars/gallery/starwars/swars017.gif)
Joined: 20 Mar 2006 Posts: 133 Topics: 58
|
Posted: Tue Apr 10, 2007 1:00 pm Post subject: DB2 V8 |
|
|
Sometime back I happen to read an article on the net which talked about the advantages of migrating to DB2V8. ( I dont have the link right now.. )
Could any one provide some info about migrating to DB2V8. Also I read that the ORDER BY clause a must in a cursor.
Could any one let me why this is a must ? what about the program which do not have order by clause ? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
kolusu Site Admin
![Site Admin Site Admin](images/ranks/adminpic.jpg)
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Wed Apr 11, 2007 2:55 am Post subject: |
|
|
From a technical point of view, ORDER BY is a must in a restartable Batch program, to be able to reposition a cursor after an interruption.
Talking about business, work is normally done in a time, partner or account orientation, and there an ORDER BY is very helpful indeed.
Just my two cents.
Christian |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
kolusu Site Admin
![Site Admin Site Admin](images/ranks/adminpic.jpg)
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
|
Posted: Wed Apr 11, 2007 8:39 am Post subject: |
|
|
CZerfas,
Do you still need an ORDER By in the following scenario?
A BMP program is to update a flag in a table from 'n' to 'y'
It opens the cursor and updates each row 1 by 1 flipping the flag (single update will do but it is a huge table which might cause deadlocks)
Now do you still need a order by ?
The same case also applies when you are deleting rows of the table
KOlusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Thu Apr 12, 2007 3:07 am Post subject: |
|
|
Hello Kolosu,
well, shurely not. But speaking of a general advice, there are not many opportunities where you can omit an ORDER BY.
Since every ORDER BY eats ressources, it is always worth to ask yourself, whether you really need an ORDER BY clause.
regards
Christian |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Martin Beginner
![](images/avatars/gallery/starwars/swars017.gif)
Joined: 20 Mar 2006 Posts: 133 Topics: 58
|
Posted: Fri Apr 20, 2007 12:45 pm Post subject: |
|
|
Kolusu,
We were hit by this PROD. There was a SQL which did not have ordaer by clause and the rows fetched from this cursor was used as a driver for orther programs. Now in V8 the order in which the rows will be fetched is diff from what it was in V7.
Any thougths as to why would they change the ordaer in which the data gets retrieved.
-Mt |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
kolusu Site Admin
![Site Admin Site Admin](images/ranks/adminpic.jpg)
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
|
Posted: Fri Apr 20, 2007 1:13 pm Post subject: |
|
|
Quote: |
Now in V8 the order in which the rows will be fetched is diff from what it was in V7.
|
martin,
You need to remember that we are communicating via web. When you say something does not work you need to provide us with enough information to suggest a solution.
Show us the sql and a sample of the data and explain to us why you think it is wrong.
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Apr 20, 2007 1:37 pm Post subject: |
|
|
I don't think that DB2 guarantees the same results table for multiple executions of a CURSOR, when there is no ORDER BY clause in the SQL; though they may be the same, DB2 is not trying to provide the same order each time. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|