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

To get last row in a query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish kanamarlapudi

New User


Joined: 23 Jul 2008
Posts: 29
Location: Little Rock - Arkansas

PostPosted: Tue Aug 05, 2008 12:33 am
Reply with quote

My requirement is that,

In one of the query where it does select one row everytime is giving -811 and so it means there are multiple records for the entry, since the production cycle running under this query is out of my subsystem i cannot view the table. but i want to fetch the last row this query is using, for first row we give 'FIRST ROW ONLY' . Similarly is thr any option for picking the last row.


Please let me know ur views n suggestions on the same.

Thx,
satish
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Aug 05, 2008 12:49 am
Reply with quote

Using the data that may be returned from a select with a failure SQL code is not a good idea, a new version of DB2 may not return the same or any data.
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: Tue Aug 05, 2008 12:53 am
Reply with quote

Hello,

I'd suggest using a cursor rather than an unpredictable query.

You might "trick" it with a FIRST and an ORDER BY DESC. . .
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 RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top