Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Select values from last row of a table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Select values from last row of a table
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: 456
Location: Belgium

PostPosted: Fri Dec 26, 2008 5:37 pm    Post subject:
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    Post subject: Reply to: Select values from last row of a table
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: 1013
Location: India

PostPosted: Fri Dec 26, 2008 10:01 pm    Post subject:
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

Site Director


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

PostPosted: Sat Dec 27, 2008 12:30 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Dec 29, 2008 8:32 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us