IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Select values from last row of a table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ilakkia
Warnings : 1

New User


Joined: 17 May 2008
Posts: 28
Location: chennai

PostPosted: Fri Dec 26, 2008 5:24 pm
Reply with quote

How to select the values only from the last row of a table?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Dec 26, 2008 5:37 pm
Reply with quote

'Last row of a table' has no real meaning. This is DB2. You are not supposed to know how the data are arranged physically in the DB2/VSAM table/file.

Do you want to know a MAX value of some column?
Back to top
View user's profile Send private message
ilakkia
Warnings : 1

New User


Joined: 17 May 2008
Posts: 28
Location: chennai

PostPosted: Fri Dec 26, 2008 6:09 pm
Reply with quote

I want to fetch the last updated row of a table?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Fri Dec 26, 2008 10:01 pm
Reply with quote

Illakkia,

If your table has something like a ROW CHANGE TIMESTAMP. Its possible.
Otherwise refer the previous post.

Sushanth
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 27, 2008 12:30 am
Reply with quote

Hello,

Quote:
I want to fetch the last updated row of a table?
For what reason? While you are reading the "the last one", others may be updated causing the one read to no longer be "last". . . icon_confused.gif

What business requirement will this support?
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Mon Dec 29, 2008 5:49 pm
Reply with quote

its possible if you have an indicator variable in the table.. reset the indicator variable on the row which is to be updated and query accordingly....
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 29, 2008 8:32 pm
Reply with quote

Hello,

Quote:
its possible if you have an indicator variable in the table.. reset the indicator variable on the row which is to be updated and query accordingly....
This might have a chance at working on a table with very low add/update activity. Logically, one could believe in this, but in a busy environment, it would fail.

For example, some of my tables are updated several thousand times a minute. . . . icon_neutral.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top