ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » how to fetch only first record in db2 table?

Post new topic  Reply to topic
 how to fetch only first record in db2 table? « View previous topic :: View next topic » 
Author Message
PRKUMAR
PostPosted: Thu Sep 20, 2012 1:26 am    Post subject: how to fetch only first record in db2 table? Reply with quote

Apprentice

Joined: 04 Sep 2012
Posts: 36

I want to fetch only first record from a db2 table. I am using the following code, but it doesn't work:
SELECT * FROM TABLE1 FETCH FIRST 1 ROWS ONLY
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Sep 20, 2012 4:41 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Use passthru for SQL constructs that are not supported by ESQL.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Sep 20, 2012 11:53 am    Post subject: Re: how to fetch only first record in db2 table? Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

PRKUMAR wrote:
I want to fetch only first record from a db2 table. I am using the following code, but it doesn't work:
SELECT * FROM TABLE1 FETCH FIRST 1 ROWS ONLY


That's an SQL select statement.

It's got no relationship, other than the name, to an ESQL select statement.

Are you using ESQL? Or some node other than a Compute node?
Back to top
View user's profile Send private message
NealM
PostPosted: Thu Sep 20, 2012 12:40 pm    Post subject: Reply with quote

Master

Joined: 22 Feb 2011
Posts: 230
Location: NC or Utah (depends)

By the way, that SQL construct will always require a passthru. It is unique to DB2. In Oracle you would use "WHERE rownum <= 1". etc. ; the Broker sticks to universal database SQL constructs in its ESQL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » how to fetch only first record in db2 table?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.