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 » Compute Node - frame DB query dynamically

Post new topic  Reply to topic
 Compute Node - frame DB query dynamically « View previous topic :: View next topic » 
Author Message
SN_IIB
PostPosted: Mon Jul 21, 2014 3:56 am    Post subject: Compute Node - frame DB query dynamically Reply with quote

Novice

Joined: 20 Jul 2014
Posts: 10

Dear Experts,

I am using esql Compute node to fetch a record from Database. I would like to dynamically frame the where clause depending on whether the fields in request sent to esql Compute node is null or not.

I placed a DB query with static where clause in esql Compute node and it worked successfully, but could not get hold how to frame it dynamically.

Please can you share your inputs?
Thanks.


Last edited by SN_IIB on Wed Feb 04, 2015 2:20 am; edited 1 time in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 21, 2014 5:09 am    Post subject: Re: Compute Node - frame DB query dynamically Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

SN_IIB wrote:
Please can you share your inputs?


That's what you do; share the inputs.

If your query becomes complex, you may find it's more maintainable to build the query string directly in ESQL and use PASSTHRU, accepting the costs to performance. Judgement call on your part there.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
SN_IIB
PostPosted: Mon Jul 21, 2014 6:09 am    Post subject: Reply with quote

Novice

Joined: 20 Jul 2014
Posts: 10

Thanks.
I understand the Performance part.
Mine is a simple select query, so I don't foresee any issue. But what I am looking for in this thread is how to technically dynamically frame the where clause in the query.


Last edited by SN_IIB on Wed Feb 04, 2015 2:20 am; edited 1 time in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jul 21, 2014 6:35 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

it depends on what you mean by 'dynamically frame the where clause'.

It's easy to use ? for WHERE A=? and B=?

but if you need to say WHERE ?=?, then you have to use passthrough.
Back to top
View user's profile Send private message
SN_IIB
PostPosted: Tue Jul 22, 2014 9:14 am    Post subject: Reply with quote

Novice

Joined: 20 Jul 2014
Posts: 10

Thanks for your inputs.

Yes I would like to frame WHERE clause in such a way that
WHERE FIELD1=x1 AND FIELD2=y1 AND FIELD3=z1. If value x1 = null, then my WHERE clause should be WHERE FIELD2=y1 AND FIELD3=z1. If the values x1=null and y1=null, then my WHERE clause should be WHERE FIELD3=z1.
In the WHERE clause mentioned above, values x1, y1 and z1 are received from a SOAP Request and passed on as input to the Compute node ESQL code.
I checked the Passthrough node as suggested, but I could not visualize how I can use it for my scenario.
Please can you help me with more pointers?
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jul 22, 2014 9:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

SN_IIB wrote:
I checked the Passthrough node as suggested, but I could not visualize how I can use it for my scenario.


PASSTHRU ESQL statement. Not the Passthru node.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Compute Node - frame DB query dynamically
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.