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

Can we retrieve last record from a table?


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

New User


Joined: 11 Jun 2006
Posts: 10

PostPosted: Wed Jul 05, 2006 12:03 am
Reply with quote

I have table containing 5 records i want to retrieve last record?

How can we fetch this in cobol program?

How can we run this in sql query?
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Wed Jul 05, 2006 11:55 am
Reply with quote

Hi,

As per codd's rules for Relational databases, there is no guaratee about order in which touples(records) stored in the database tables.
If you wish to retrive the last order, you must use order by clause along with the cursor.. or agreegate function like MAX in your select query.

I am not sure if ROWID can solve your purpose.

Thanks,
Parikshit.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Load new table with Old unload - DB2 DB2 6
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top