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 » Select query on multiple segments which are repeating

Post new topic  Reply to topic
 Select query on multiple segments which are repeating « View previous topic :: View next topic » 
Author Message
lokeshraghuram
PostPosted: Tue Mar 18, 2014 6:40 am    Post subject: Select query on multiple segments which are repeating Reply with quote

Novice

Joined: 10 Dec 2013
Posts: 14

Hi

Could anyone help me out with the below issue

Requirement : Select query should be done on repeating segments and count of one of the segment should be returned.

Example :

<Example>
<Level1Tag>
<Level2tag>
<Level3Tag>
<Count>1</Count>
</Level3Tag>
<Level3Tag>
<Count>2</Count>
</Level3Tag>
</Level2tag>
<Level2tag>
<Level3Tag>
<Count>3</Count>
</Level3Tag>
<Level3Tag>
<Count>4</Count>
</Level3Tag>
</Level2tag>
</Level1Tag>
</Example>

Code:
SET Count = Select Count(*) FROM Example.Level1tag[] as level1ref, level1ref.Level2tag[] as level2ref, level2ref.Level3Tag[] as level3ref;
Answer : 4


The above scenario is working fine but when any of the segment is not present then its not working. Consider Level3Tag is not present in the second Level2Tag. So level3ref will be assigned to NULL and select query processing is stopping at this point. I could tell this because in debug under variables, level2ref has the first Level2Tag data and not the third Level2Tag data..the above scenario is given below

<Example>
<Level1Tag>
<Level2tag>
<Level3Tag>
<Count>1</Count>
</Level3Tag>
<Level3Tag>
<Count>2</Count>
</Level3Tag>
</Level2tag>
<Level2tag>
</Level2tag>
<Level2tag>
<Level3Tag>
<Count>3</Count>
</Level3Tag>
<Level3Tag>
<Count>4</Count>
</Level3Tag>
</Level2tag>
</Level1Tag>
</Example>

Expected answer is 4 but it is returning 2

While loop is the last solution but is there any way this could be done using select query

Thank you
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 » Select query on multiple segments which are repeating
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.