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 » fetching n rows from the db

Post new topic  Reply to topic
 fetching n rows from the db « View previous topic :: View next topic » 
Author Message
ashkalp
PostPosted: Fri Jun 27, 2014 2:26 am    Post subject: fetching n rows from the db Reply with quote

Newbie

Joined: 27 Jun 2014
Posts: 1

I am using DatabaseInput node to read the records/Events from the oracle db. I want to fetch n records from the db based on some condition. But i am unable to do it. In ReadEvent I use:
SET NewEvents.Event[] = SELECT AE_EVENT_STORE.* AS Usr, AE_EVENT_STORE.PRIMARYKEY AS Key FROM CMS_MELLON.AE_EVENT_STORE
WHERE AE_EVENT_STORE.BATCH_FLAG = 'I' AND (AE_EVENT_STORE.PROCESSED IS NULL OR AE_EVENT_STORE.PROCESSED = 'N')AND ROWNUM<=100;

In BuildMessage i write:
SET Root.DataObject.AE_EVENT_DATA[] = SELECT AE_EVENT_DATA.* FROM Database.CMS_MELLON.AE_EVENT_DATA WHERE AE_EVENT_DATA.CONTEXTIDGUID = DispatchedEvent.Usr.PRIMARYKEY;

Here I want to fetch 100 records only, but my code does not work. Please reply.
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Fri Jun 27, 2014 3:27 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

You may not be able to do it via an ESQL Select.

you may have to drop into the DB SQL using a Passthru.

for example on SQLServer, you could write a select
Code:


select top 100 * ... from .... where


DB2 and Oracle have their own ways to do this.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jun 27, 2014 5:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

While smdavies99's suggestion is helpful, it may not actually apply here.

BuildMessage is going to be called once for each individual Event that you put into NewEvent.

What you are doing in your ReadEvent is fetching N rows each DatabaseInput node polling interval and sending each row to BuildMessage to be propagated out of DatabaseInput node.

So if you want each message propagated out of DatabaseInput to contain N rows, then you need to change the query in BuildMessage to use N rows, rather than using ReadEvent.
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 » fetching n rows from the db
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.