|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Database Select Loop |
« View previous topic :: View next topic » |
Author |
Message
|
Chuck831 |
Posted: Fri Jan 14, 2005 2:29 pm Post subject: Database Select Loop |
|
|
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 |
|
 |
EddieA |
Posted: Fri Jan 14, 2005 3:18 pm Post subject: |
|
|
 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 |
|
 |
JT |
Posted: Fri Jan 14, 2005 3:19 pm Post subject: |
|
|
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 |
|
 |
Chuck831 |
Posted: Fri Jan 14, 2005 4:15 pm Post subject: |
|
|
Apprentice
Joined: 23 Dec 2002 Posts: 28
|
Thank you. The more I looked at it the less I saw.  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|