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 » Help with ESQL in compute node.

Post new topic  Reply to topic
 Help with ESQL in compute node. « View previous topic :: View next topic » 
Author Message
wmb61_user
PostPosted: Wed Jul 09, 2008 11:21 am    Post subject: Help with ESQL in compute node. Reply with quote

Novice

Joined: 08 May 2008
Posts: 18

I have two SQLs going after a the same set of tables using the PASSTHRU funciton. One to get the header level information and one to get the line level information. I did it this way as I only need one instance of header information in my entire document.

I am sure there is a better way of doing this instead of using two SQLs which is affecting the performance. How do I do this?.

Ex:
I have
SELECT ORD_NBR FROM ORD_HDR;
SELECT ITM_NBR FROM ORD_LINE;

My output looks like this.

<ORD_NBR ABC </ORD_NBR>
< ITEM_NBR 123 </ITM_NBR>
< ITEM_NBR 456 </ITM_NBR>

Instead I would like use

SELECT ORD_NBR ,ITM_NBR FROM ORD_HDR A,ORD_LINE B
WHERE A.ORD_NBR = B.ORD_NBR;

How do I make my output look the same as above.
Back to top
View user's profile Send private message
sridhsri
PostPosted: Wed Jul 09, 2008 12:46 pm    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

Can you please tell me why you decided to use the PASSTHRU function ? You could write those two SQL statements in ESQL. that does give better performance than PASSTHRU.
Back to top
View user's profile Send private message
wmb61_user
PostPosted: Wed Jul 09, 2008 1:28 pm    Post subject: Reply with quote

Novice

Joined: 08 May 2008
Posts: 18

The bottom line is that it is not efficient to do to SQL calls when you can get away with one.
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Jul 09, 2008 8:49 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

Quote:
SELECT ORD_NBR ,ITM_NBR FROM ORD_HDR A,ORD_LINE B
WHERE A.ORD_NBR = B.ORD_NBR;


when you use this query with passthru.... how does your output look like ??
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Maximreality
PostPosted: Thu Jul 10, 2008 12:56 am    Post subject: Re: Help with ESQL in compute node. Reply with quote

Acolyte

Joined: 04 Jun 2004
Posts: 65
Location: Copenhagen

If you are worried about performance you should at least make your PASSTHRU SQL statements as prepared statements....
If you use ESQL the broker automatically generates prepared SQL statements.

In ESQL your SQL statement would look like this:
Code:
SET OutputRoot.XML.Orders.Result[] = (SELECT A.ORD_NBR, B.ITEM_NBR FROM Database.ORD_HDR AS A, Database.ORD_LINE AS B WHERE A.ORD_NBR = B.ORD_NBR);


If you want your output presented nicely you need to make a more advanced statement...., take a look in the ESQL reference quide from IBM there should be some examples of joining data form two tables and formatting it in XML.
Back to top
View user's profile Send private message
wmb61_user
PostPosted: Thu Jul 10, 2008 7:24 am    Post subject: Reply with quote

Novice

Joined: 08 May 2008
Posts: 18

Akankhsa,

The output looks like this.

<ORD_NBR ABC </ORD_NBR>
< ITEM_NBR 123 </ITM_NBR>
<ORD_NBR ABC </ORD_NBR>
< ITEM_NBR 456 </ITM_NBR>
Back to top
View user's profile Send private message
sridhsri
PostPosted: Thu Jul 10, 2008 8:27 pm    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

If you could write a stored procedure perhaps you could construct a result set (or even two result sets) to give you the desired output. You could then invoke the stored procedure from esql.
Back to top
View user's profile Send private message
AkankshA
PostPosted: Thu Jul 10, 2008 9:42 pm    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

One way to acheve this could be .. Do not store the result in output tree directly.... get the result from DB in environment tree and then build output tree as per your requirement....
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Help with ESQL in compute node.
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.