MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 V8

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Tue Apr 10, 2007 1:00 pm    Post subject: DB2 V8 Reply with quote

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.. Sad )

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue Apr 10, 2007 2:05 pm    Post subject: Reply with quote

Here is an excellent article about DB2 V8

http://www.dbazine.com/db2/db2-disarticles/zikopoulos11

Also read this book

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNWNJ11/CCONTENTS?DT=20061212110132

Order by clause is a MUST? I haven't heard any thing about it

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
View user's profile Send private message Send e-mail Visit poster's website
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Wed Apr 11, 2007 2:55 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Wed Apr 11, 2007 8:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Thu Apr 12, 2007 3:07 am    Post subject: Reply with quote

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
View user's profile Send private message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Fri Apr 20, 2007 12:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Apr 20, 2007 1:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Apr 20, 2007 1:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group