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 » Database Select Loop

Post new topic  Reply to topic
 Database Select Loop « View previous topic :: View next topic » 
Author Message
Chuck831
PostPosted: Fri Jan 14, 2005 2:29 pm    Post subject: Database Select Loop Reply with quote

Apprentice

Joined: 23 Dec 2002
Posts: 28

Hi,

I am attempting to retrieve a group of records from an Oracle database and add values from the rows retrieved to an output message. However, it appears to be timing out and is not producing any errors. Could someone possibly point me in the right direction. The code follows.

Thanks.

Code:

Set Environment.Variables.Result[] =
   (SELECT A.ISR_NO, A.S_MODE FROM
        Database.ISR as A
          where A.EXTERNAL_NO1 = 'SLN123456789');

Set I = 1;
Set MaxRecs = Cardinality(Environment.Variables.Result[]);

If MaxRecs > 10 Then
  Set MaxRecs = 10;
End If;

While I <= MaxRecs Do
   Set OutputRoot.XML.DataArea.ISR[I]  = Environment.Variables.Result.ISR_NO[I];
   Set OutputRoot.XML.DataArea.ISR[I].(XML.Attribute)index = I;
   Set OutputRoot.XML.DataArea.SMODE[I]  = Environment.Variables.Result.SMODE[I];
   Set OutputRoot.XML.DataArea.SMODE[I].(XML.Attribute)index = I;
End While;
Back to top
View user's profile Send private message
EddieA
PostPosted: Fri Jan 14, 2005 3:18 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

You don't appear to be incrementing I within the loop, so it will always be less than MaxRecs.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
JT
PostPosted: Fri Jan 14, 2005 3:19 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Try this:
Code:
While I <= MaxRecs Do
   Set OutputRoot.XML.DataArea.ISR[I]  = Environment.Variables.Result[I].ISR_NO;
   Set OutputRoot.XML.DataArea.ISR[I].(XML.Attribute)index = CAST(I AS CHARACTER);
   Set OutputRoot.XML.DataArea.SMODE[I]  = Environment.Variables.Result[I].S_MODE;
   Set OutputRoot.XML.DataArea.SMODE[I].(XML.Attribute)index = CAST(I AS CHARACTER);
   Set I = I + 1;
End While;
Back to top
View user's profile Send private message
Chuck831
PostPosted: Fri Jan 14, 2005 4:15 pm    Post subject: Reply with quote

Apprentice

Joined: 23 Dec 2002
Posts: 28

Thank you. The more I looked at it the less I saw.
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 » Database Select Loop
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.