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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts To Discard record with 0 entry if Dup... SYNCSORT 7
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Write record twice based on condition... SYNCSORT 7
Search our Forums:


Back to Top